lambda syntax tutorial (3. Defender Methods)
Howard Lovatt
howard.lovatt at gmail.com
Thu Aug 5 17:24:01 PDT 2010
> 3. Defender Methods
> -------------------
>
> Defender methods are declared using the 'extension' keyword, as follows:
>
> extension List<T> map(Mapper<T> r) default Collections.<T>listMapper;
>
> A defender method declaration is structured in two parts, (i) a method
> signature, declaring formal arguments, formal type-arguments and
> return-type and (ii) a default implementation, that is, the implementation
> the method should default to if none is found in the class implementing
> the extended interface.
To be consistent with Javadoc and Method References I would suggest:
extension List<T> map(Mapper<T> r) default Collections#<T>listMapper;
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).
-- Howard.
More information about the lambda-dev
mailing list