JavaFX ObservableSet handle change event
import javafx.collections.FXCollections; import javafx.collections.ObservableSet; import javafx.collections.SetChangeListener; public class Main { public static void main(String[] args) { // Create an observable set with two elements ObservableSet<String> set = FXCollections.observableSet("one", "two"); System.out.println(set);//from ww w . j a v a2 s. co m set.addListener((SetChangeListener.Change<? extends String> change) -> { System.out.println("The map has changed."); }); } }