Method reference conversion

Uther uther.ii at gmail.com
Thu Dec 15 12:35:41 PST 2011


Hello. I have been reading this mailing list from long time but didn't 
post anything right now since I'm not a Java expert, but I was 
wonderning about Method references.

Will every reference to a same method be converted to the same object? 
Will the language specification tell something about it?

For exemple:
Runnable method1 = this::myMethod;
Runnable method2 = this::myMethod;
System.out.println(method1 == method2); //returns true

I'm not sure it is technicaly possible, but it would be very nice that 
specification garantee that, it may allow to do interesting things like 
a removeListener(this::myListener) after a addListener(this::myListener);


More information about the lambda-dev mailing list