lambda syntax tutorial (3. Defender Methods)
Rémi Forax
forax at univ-mlv.fr
Fri Aug 6 08:03:39 PDT 2010
Le 06/08/2010 03:11, Brian Goetz a écrit :
>> To be consistent with Javadoc and Method References I would suggest:
>>
>> extension List<T> map(Mapper<T> r) default Collections#<T>listMapper;
>>
> Ah, but that would only expose another inconsistency, which would surely
> result in the following question: "why can I use a method reference but not a
> lambda expression?"
>
perhaps because method reference is a kind of constant lambda.
A constant lambda has the great property to be 'internable'
(inserted in the bytecode) by the compiler.
>
>> IE use a # instead of a . so that it is clear that it is a literal
>> reference to a method and not a method call (as well as the
>> consistency reason already mentioned).
>>
Rémi
More information about the lambda-dev
mailing list