# The Collectors.groupingBy Method

//The following example groups members of the collection roster by gender:

Map<Person.Sex, List<Person>> byGender =
roster
.stream()
.collect(
Collectors.groupingBy(Person::getGender));

The groupingBy operation returns a map whose keys are the values that result from applying the lambda expression specified as its parameter (which is called a classification function).

## Related concepts

The Collectors.groupingBy Method

## The Collectors.groupingBy Method — Structure map

Clickable & Draggable!