groupingByConcurrent javadoc shows an example use that does not require a map factory

Brian Goetz brian.goetz at
Mon Jun 17 16:21:59 PDT 2013

No, the default factory is HashMap::new.  This asks for a TreeMap, which 
has the additional property of having a sorted encounter order for keys.

On 6/17/2013 7:13 PM, Arul Dhesiaseelan wrote:
> Looks like this example in Collectors javadoc needs to be corrected for
> groupingByConcurrent that does not take a map factory?
>            ConcurrentMap<City, Set<String>> namesByCity
>                =
>, TreeMap::new,
>   mapping(Person::getLastName, toSet())));
> map factory should not be included in this example, as it uses the default
> factory.
> - Arul

More information about the lambda-dev mailing list