Collectors.toMap() keyMapper function question
pfurbacher
pfurbacher at mac.com
Tue Oct 8 17:01:23 UTC 2013
I'm wondering how to more succinctly express the "keyMapper" function which
is highlighted in the following:
List<Person> roster = ...;
Map<String, Person> map =
roster
.stream()
.collect(
Collectors.toMap(
*new Function<Person, String>() {
public String apply(Person p) { return
p.getLast(); }
}*,
Function.<Person>identity()));
Thanks.
--
View this message in context: http://openjdk.5641.n7.nabble.com/Collectors-toMap-keyMapper-function-question-tp159371.html
Sent from the OpenJDK General discussion mailing list archive at Nabble.com.
More information about the discuss
mailing list