We need to get characters stream from string in upper case. There are two approaches:
word.toUpperCase().chars()word.chars().map(Character::toUpperCase)
Which approach is better?
P.S. as requested in comments I specify the whole method where the code is used:
private int[] toSortedChars(final String word) {
return word.chars().map(Character::toLowerCase).sorted().toArray();
}
The method is used to solve the exercise: https://exercism.org/tracks/java/exercises/anagram