So why doesn't this complain: n.managedProperty().<ChangeListener>addListener(x -> test(x));
"ChangeListener" has no business being there. Scott On Thu, Mar 20, 2014 at 4:02 PM, Scott Palmer <swpal...@gmail.com> wrote: > Thanks.. just figured that out myself. > As my colleague just said to me "the world is good again" > > On Thu, Mar 20, 2014 at 4:00 PM, Richard Bair <richard.b...@oracle.com> wrote: >> InvalidationListener has one param, ChangeListener has 3. So the arity of >> the lambda tells the compiler which kind to produce. If there was ambiguity, >> the compiler would complain. >> >> Richard >> >> On Mar 20, 2014, at 12:54 PM, Scott Palmer <swpal...@gmail.com> wrote: >> >>> 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 >>