Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created July 18, 2020 20:49
Show Gist options
  • Save theboreddev/b820c19a87e372131b3b5898499bd8cc to your computer and use it in GitHub Desktop.
Save theboreddev/b820c19a87e372131b3b5898499bd8cc to your computer and use it in GitHub Desktop.
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