Substitute for groupingReduce ?
brian.goetz at oracle.com
Wed Mar 20 12:36:20 PDT 2013
I think you're missing a reduce function in that call? I see a
classifying function and a merge function.
But here are some possible answers:
Cities by name:
Map<String, List<City>> citiesByName
Total population by name:
Map<String, Integer> cityPopsByName
Biggest city by name:
Comparator<City> bySize = Comparators.comparing(City::getPop);
Map<String, City> biggestCityByName
On 3/20/2013 3:24 PM, Michael Nascimento wrote:
> Hi guys,
> I had this before:
> Map<String, City> cityByName = cities.stream().collect(groupingReduce(
> city -> city.getName(), throwingMerger()));
> What is the proper replacement?
More information about the lambda-dev