DevoxxUK Lambdas Lab

Brian Goetz brian.goetz at oracle.com
Wed Apr 3 08:28:13 PDT 2013


Computing Map as the *result* of a stream computation is a use case we 
want to address, and we've added a lot of support (mostly in Collectors) 
for doing so.

Performing stream-like calculations on maps, on the other hand, like:

   map.stream()  // we don't have this
      .filter((k,v) -> v.isFoo())
      .mapValues((k,v) -> f(k,v))
      .collect(toMap());

is something we tried to support but ultimately concluded was going to 
be out of scope for this exercise.

One of the things that convinced us to scope back on this was that 
surprisingly many of the use cases for "map streams" could be expressed 
using collect() instead.

On 4/3/2013 11:12 AM, Stephen Colebourne wrote:
> On 3 April 2013 16:04, Brian Goetz <brian.goetz at oracle.com> wrote:
>> I know you want MapStream.  We did too.  I am sorry you are disappointed.
>> But this request doesn't solve the problem.
>
> If it is your/Oracle's opinion that developers should not intermix
> streams and Map then this needs to be called out in the Stream API
> documentation.
>
> Personally, converting Stream<Person> to Map<PersonId, Address> looks
> pretty basic to me. And has nothing to do with Map.
>
> Stephen
>


More information about the lambda-dev mailing list