Round 1 feedback

Brian Goetz brian.goetz at oracle.com
Wed Jan 9 08:13:05 PST 2013


So, we looked at bringing this in in 8.  And we looked at the 
thrust/weight ratio.  The Guava Multimap family is biiiig.  Not clear 
that all that code and API surface area (and the endless tail of 
"Where's LinkedMultimap?  Where's ConcurrentMultimap?  Where's 
LinkedConcurrentMultimap?") is worth the benefit.

What we did in 8 is add {Map,ConcurrentMap}.computeIfAbsent.  This 
eliminates 80% of the pain of simulating a multimap with a 
Map<K,Collection<V>>.  To wit:

void add(K k, V v) {
   map.computeIfAbsent(k, ArrayList::new).add(v);
}

This is only slightly worse than
   multimap.add(k, v);

and certainly way less pain than doing it today.

With this tweak, I think the argument in favor of adding Multimap to the 
JDK loses about 80% of its steam.

On 1/9/2013 10:58 AM, Michael Nascimento wrote:
> On Wed, Jan 9, 2013 at 1:55 PM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
>> I interpreted the question as "are we going to add a Multimap class to the JDK?".
>
> You got it right, Paul, and I hope the answer is yes, even if it'll
> only happen for JDK 9.
>
> Regards,
> Michael
>


More information about the lambda-dev mailing list