listeners and lambda method reference

sebastien deries sebastien.deries at
Tue Feb 10 16:53:04 UTC 2015

Hi all,

While working on memory leak issues in my application, I discovered that I
had a problem with the way I use lambda reference method.

Here is the problem:

public class Lambda {

    private final Property<Boolean>       property;

    public Lambda() {

        property = new SimpleBooleanProperty();





    private void propertyChanged(ObservableValue<? extends Boolean>
notifier, Boolean previous, Boolean next) {

        System.out.println(" hello !");


    public static void main(String[] args) {

        new Lambda();



In this example, I have a property and want to listen to the property
changes. When I run this example, the console output says “hello!” whereas
I removed the listener. I thought that the syntax this::propertyChanged was
giving me a single instance of ChangeListener, but I was apparently wrong.

Is this normal?



More information about the lambda-dev mailing list