Created
August 15, 2015 12:26
-
-
Save jmaciasluque/5b05479c2fbedbe1ec66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static List<String> processWords(List<String> wordList, boolean parallel) { | |
Supplier<Stream<String>> streamSupplier = parallel ? wordList::parallelStream : wordList::stream; | |
return | |
streamSupplier.get() | |
.sorted() | |
.map(String::toLowerCase) | |
.map(String::toUpperCase) | |
.filter(word -> !word.startsWith("a")) | |
.filter(word -> !word.startsWith("A")) | |
.filter(word -> !word.startsWith("z")) | |
.filter(word -> !word.startsWith("Z")) | |
.filter(word -> !word.startsWith("m")) | |
.filter(word -> !word.startsWith("M")) | |
.distinct() | |
.collect(Collectors.toList()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment