Constructor references

Stephen Colebourne scolebourne at joda.org
Fri Jul 16 02:46:00 PDT 2010


On 16 July 2010 08:31, Fredrik Ohrstrom <oehrstroem at gmail.com> wrote:
> 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.

Well, I'd simply make the constructor reference do the allocation.
Thats the most expected behaviour.

> To do that new code has to be created, so why not
> go with a lambda?
> { name, age -> new Person(name, age) }

Same argument applies to method references. They are being added
because they are a common and useful convenience.

Stephen


More information about the lambda-dev mailing list