Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created July 18, 2020 20:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save theboreddev/dafebfcea5943f3267e980ebea1e630d to your computer and use it in GitHub Desktop.
Save theboreddev/dafebfcea5943f3267e980ebea1e630d to your computer and use it in GitHub Desktop.
groupBySexToSet
final Map<Employee.Sex, Set<Employee>> employeesBySex = employees.stream()
.collect(groupingBy(Employee::getSex, toSet()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment