Updated State of the Lambda
Stephen Colebourne
scolebourne at joda.org
Mon Dec 12 16:28:51 PST 2011
On 12 December 2011 23:55, Brian Goetz <brian.goetz at oracle.com> wrote:
>> On Dec 12, 2011, at 3:21 AM, Stephen Colebourne wrote:
>>
>>> int sum = list.map(e -> e.size()).reduce(0, (a, b) -> a+b);
>
> Though this is better stated as:
>
> int sum = list.map(E::size)
> .reduce(0, Integer::plus);
Actually, that seems less clear to me, as its not transforming/mapping
anything visibly (a lambda has the visual effect of transform this to
this, such as e -> e.size(), whereas just E::size doesn't visibly
transform/map anything)
Stephen
More information about the lambda-dev
mailing list