Lambda Lambda

Scott Palmer swpalmer at gmail.com
Thu Mar 20 19:54:42 UTC 2014


So I'm looking at Java 8 stuff now and I see that addListener has
methods.  One takes a ChangeListener, the other an
InvalidationListener.

So what does this do:

Node n = getSomeNode();
n.managedProperty().addListener(x -> test(x));

Well it seems it adds an InvalidationListener.

So I tried this:

n.managedProperty().<ChangeListener>addListener(x -> test(x));

which seems to be accepted syntax, but it still adds an InvalidationListener !!!

Help Please.

Why didn't JavaFX 8 add two new methods:
addChangeListener
addInvalidationListener

?

Scott


More information about the openjfx-dev mailing list