Transform a set into a map using the current lambda API

Michael Nascimento misterm at gmail.com
Wed Mar 27 08:03:43 PDT 2013


On Wed, Mar 27, 2013 at 12:01 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> Does
>
>    properties.stream().collect(HashMap::new, (m,p) -> m.put(p.name, p), Map::putAll);
>
> seem so verbose or obscure?

I think the problem is it will be hard to figure out this is the way
out. And there are many Collectors that are less likely to be used in
these applications, such as the current reverse form.

> Not averse to a canned Collector for it.  Hard part is the right name.  (Cue bikeshed frenzy.)

uniqueIndex? :-D

Regards,
Michael


More information about the lambda-dev mailing list