Created
April 1, 2017 00:49
-
-
Save liviutudor/332e8a38adbcb91ef50f2168d88ab262 to your computer and use it in GitHub Desktop.
Implement a `map`-like without streams
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
public Collection<Double> extract(Collection<Employee> collection) { | |
Collection<Double> list = new ArrayList<>(); | |
if( collection == null || collection.isEmpty() ) return list; | |
for( Employee e : collection ) { | |
list.add(e.salary); | |
} | |
return list; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment