summary of point lambdafication survey
Stuart Marks
stuart.marks at oracle.com
Fri Sep 23 11:44:51 PDT 2011
>> * Collections.toMap(keyGen)
>> - for each element in a Collection, generate a key, store into a Map
>> - could be a static utility method or an extension method
>
> This is interesting. It's sort-of halfway between two different ideas.
>
> One take would be for it to take a value-generating lambda (a Mapper) which
> would be run over each element in a Set. The result would be a Map object whose
> keys are the elements from the Collection and whose values are the results from
> the Mapper.
>
> Another take is to generate keys from each element of a Collection; the
> question then what to do in the case of duplicate keys. We'd want the resulting
> Map to have multiple values for a single key. This could be expressed as a
> (hypothetical) MultiMap, or as an ordinary Map whose values are Lists.
... which turns it into groupBy.
More information about the lambda-dev
mailing list