I have the following class.
class Person { String name; LocalDate birthday; Sex gender; String emailAddress; public int getAge() {
You can use a mapping Collector to map the list of Person to a list of person names :
mapping
Collector
Person
Map> collect = members.stream() .collect(Collectors.groupingBy(Person::getAge, Collectors.mapping(Person::getName, Collectors.toList())));