Round 1 feedback

Arul Dhesiaseelan aruld at acm.org
Thu Feb 14 00:20:54 PST 2013


With b77, you can make this pretty :-)

fooBySomething.values().stream().flatMap(Collection::stream).collectUnordered(toList());

-Arul


On Wed, Feb 13, 2013 at 6:32 PM, Michael Nascimento <misterm at gmail.com>wrote:

> On Wed, Jan 9, 2013 at 2:13 PM, Brian Goetz <brian.goetz at oracle.com>
> wrote:
> > 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.
>
> Ok, now to a different point of the Multimap discussion. Turning this:
>
> Collection<Foo<Bar>> values = fooBySomething.values();
>
> into this:
>
> Collection<Foo<Bar>> values =
> fooBySomething.values().stream().<Foo<Bar>>explode((d, foos) ->
> d.send(foos)).collectUnordered(toList());
>
> is pretty ugly, isn't it? Or is there a better way?
>
> Regards,
> Michael
>
>


More information about the lambda-dev mailing list