Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
employeesOverThirtyBySex
final Map<Employee.Sex, List<Employee>> employeesOverThirtyBySex = employees.stream()
.collect(groupingBy(Employee::getSex, filtering(employee -> employee.getAge() > 30, toList())));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment