如何在
java8中用lambda编写一个新的ListChangeListener()?
listItems.addListener(new ListChangeListener<Item>() { @Override public void onChanged( javafx.collections.ListChangeListener.Change<? extends Item> c) { // TODO Auto-generated method stub } });
这是我试过的:
listItems.addListener(c->{});
但日食说:
The method addListener(ListChangeListener) is ambiguous for the
type ObservableList.
列表被声明为:
ObservableList<Item> listItems = FXCollections.observableArrayList();