Updated State of the Lambda
Gernot Neppert
mcnepp02 at googlemail.com
Mon Dec 12 11:23:08 PST 2011
Am 12.12.2011 12:21, schrieb Stephen Colebourne:
> int sum = list.map(e -> e.size()).reduce(0, (a, b) -> a+b);
>
> I continue to be concerned about the verbs being used and their
> readability. Clearly these terms are used elsewhere, but I continue to
> be of the opinion that "map" is the wrong verb for Java, because of
> Java.util.Map. My preference currently remains as
> "transform/Transformer". Similarly, I think "combine" may be a better
> verb than "reduce". With altered verbs, I think the mental shift
> required is lessened:
>
> int sum = list.transform(e -> e.size()).combine(0, (a, b) -> a+b);
I endorse your suggestion. I'd also prefer "transform", mainly because I
tend to connect the verb "map" mentally with an operation such as the
following:
interface Collection<E> {
....
public <K,M extends Map<? super K,? super E> M map(Function<? super E,?
extends K> mapper, M target);
More information about the lambda-dev
mailing list