Skip to content

Commit

Permalink
fix eclipse-collections#289 Update TextProcessorEC.java
Browse files Browse the repository at this point in the history
  • Loading branch information
nkadhane authored Sep 22, 2023
1 parent fd7f215 commit 886645a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public Triple<CharBag, CharBag, CharSet> duplicatesAndUnique()

public CharCharPair topVowelAndConsonant()
{
private static final char DEFAULT_CHAR = ' ';
// Collecting all the alphabetic letters from getHaikuAsCharAdapter(), converting them to lowercase,
// putting them in a bag and then getting the top 26 occurrences.
MutableList<CharIntPair> charIntPairs = this.getHaikuAsCharAdapter()
Expand All @@ -90,8 +91,8 @@ public CharCharPair topVowelAndConsonant()
char topVowel = topVowelPair == null ? ' ' : topVowelPair.getOne(); // Default to space if no vowel is found.

// Finding the top consonant.
CharIntPair topConsonantPair = charIntPairs.detect(pair -> !isVowel(pair.getOne()));
char topConsonant = topConsonantPair == null ? ' ' : topConsonantPair.getOne(); // Default to space if no consonant is found.
CharIntPair topVowelPair = charIntPairs.detect(pair -> isVowel(pair.getOne()));
char topVowel = topVowelPair == null ? DEFAULT_CHAR : topVowelPair.getOne(); // Use the named constant here

return PrimitiveTuples.pair(topVowel, topConsonant);
}
Expand Down

0 comments on commit 886645a

Please sign in to comment.