Constructor references

Fredrik Ohrstrom oehrstroem at gmail.com
Fri Jul 16 00:31:04 PDT 2010


Yes, however it is not quite a normal method reference because the
constructor does not allocate so you want the constructor prefixed
with an alloc. To do that new code has to be created, so why not
go with a lambda?

{ name, age -> new Person(name, age) }


2010/7/16 Stephen Colebourne <scolebourne at joda.org>:
> The latest SotL document does not mention constructor references. A
> constructor is no more than a special kind of method. Omitting it from
> JDK 7 would, I suspect, be an annoyance to developers.
>
> The obvious syntaxes are:
>
>  Person#()
>  Person#(String, int)
>
> or
>
>  Person#<init>()
>  Person#<init>(String, int)
>
> Has any consideration been given to constructor references?
>
> Stephen
>
>


More information about the lambda-dev mailing list