summary of point lambdafication survey
Yuval Shavit
yshavit at akiban.com
Fri Sep 23 13:39:07 PDT 2011
Collections.toMap sounds like a convenience function for a fold, is that
about right?
On Fri, Sep 23, 2011 at 2:44 PM, Stuart Marks <stuart.marks at oracle.com>wrote:
>
> >> * 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