Skip to content

Instantly share code, notes, and snippets.

@nestharus
Created October 30, 2019 02:09
Show Gist options
  • Save nestharus/ee2999000c72b4860cd0b198a72266dd to your computer and use it in GitHub Desktop.
Save nestharus/ee2999000c72b4860cd0b198a72266dd to your computer and use it in GitHub Desktop.
public static Map<String, Set<String>> idsAndFields(final Collection<Match> matches) {
return matches.stream()
.collect(Collectors.groupingBy(
match -> match.id,
Collectors.flatMapping(
match -> match.positions().stream()
.map(position -> position.fieldName),
Collectors.toSet()
)
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment