Given a Map where Person has a String getName() (etc) method on it, how can I turn the Map
Map
String getName()
One way is to use a toMap collector:
toMap
import static java.util.stream.Collectors.toMap; Map byNameMap = people.entrySet().stream() .collect(toMap(Entry::getKey, e -> e.getValue().getName()));