Allocation of Lambdas that capture "this"

Neal Gafter neal at gafter.com
Mon Oct 13 18:12:13 UTC 2014


On Wed, Aug 20, 2014 at 4:58 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:

> Is there any reason not to initialize the field directly? like
>
> final Consumer<Msg> readHandler = (Msg obj)-> {
>     this.doSomethingWith(obj);
>     ...
> };
>

You are not allowed to access "this" in a field initializer.


More information about the lambda-dev mailing list