Created
October 8, 2018 17:50
-
-
Save edwingustafson/9fa20c21048fa07031100a9e574124bb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public List<String> imperative(List<String> terms) { | |
List<String> result = new ArrayList<String>(terms.size()); | |
for(term : terms) { | |
if(term.length > 3) { | |
restult.add(term.toUpperCase()); | |
} | |
} | |
return result; | |
} | |
public List<String> functional(List<String> terms) { | |
return terms.stream(). | |
filter(term -> term.length > 3). | |
map(String::toUpperCase). | |
toList() | |
; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment