DevoxxUK Lambdas Lab
Brian Goetz
brian.goetz at oracle.com
Wed Apr 3 08:04:50 PDT 2013
>>> ACTION:
>>> Add a much better way to convert a stream of Entry to a Map. Perhaps:
>>> .collect(Collectors.toMap(entry -> getKey(), entry ->
>>> entry.getValue()));
>
> I really don't think the method above is a big ask, and it is
> generally useful for other cases. For example, processing a
> Stream<Person> with the goal of outputting Map<PersonId, Address>.
By itself, maybe not. But its of a very different type than the
"reducingSum" request. The reducingSum() is asking for a convenience
method at the "leaf". But the above is more likely simply the first
slide down a very long and slippery slope. (And one that merely
encourages people to write horrible code involving streams of Map.Entry.)
If the request were one that truly solved (as in, now the problem is
actually completely solved) a large set of problems, I'd think
differently. But I think it creates as many problems as it solves.
I know you want MapStream. We did too. I am sorry you are
disappointed. But this request doesn't solve the problem.
More information about the lambda-dev
mailing list