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

Arul Dhesiaseelan aruld at
Mon Jun 17 17:11:52 PDT 2013

Ok, this example fails to compile in build 94 with incompatible types
error, since TreeMap is not a ConcurrentMap, so this example still needs
correction, no?

java: incompatible types: Cannot instantiate inference variables T because
of an inference loop

On Mon, Jun 17, 2013 at 1:21 PM, Brian Goetz <brian.goetz at> wrote:

> 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