Since ObservableList
inherits addListener(InvalidationListener)
from the Observable
interface, the compiler is unable to determine which version to call. Specifying the type of the lambda through a cast should fix this.
listItems.addListener((ListChangeListener)(c -> {/* ... */}));
You can also explicitly specify the type of c
:
listItems.addListener((ListChangeListener.Change<? extends Item> c) -> {/* ... */});