Method reference conversion

Brian Goetz brian.goetz at oracle.com
Thu Dec 15 13:10:28 PST 2011


Most likely outcome: no guarantees (such guarantees come with a cost) but it is "highly likely" that method1 == method2.  

When we finish the implementation of functional interface conversion we'll have a update.  

On Dec 15, 2011, at 3:35 PM, Uther wrote:

> 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