Skip to content

Instantly share code, notes, and snippets.

@liviutudor
Created April 1, 2017 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liviutudor/332e8a38adbcb91ef50f2168d88ab262 to your computer and use it in GitHub Desktop.
Save liviutudor/332e8a38adbcb91ef50f2168d88ab262 to your computer and use it in GitHub Desktop.
Implement a `map`-like without streams
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