I have a Stream<Pair<String, String>> myStream;
and I'd like to aggregate it into a Map<String, Set<String>> result;
I managed to get to the following:
Map<String, Set<Pair<String, String>>> result = myStream
.collect(Collectors.groupingBy(Pair::getKey, Collectors.toSet()));
This fails with "Non-static method cannot be referenced from a static contex":
Map<String, Set<String>> result = myStream
.collect(Collectors.groupingBy(Pair::getKey, Pair::getValue, Collectors.toSet()));
What am I doing wrong?