I have an observable list ObservableList<Integer> list = FXCollections.observableArrayList().
In the getter method for, listI want to return a list of read-only observables, for example:
public ObservableList<Integer> getReadOnlyList() {
return readOnlyObservableList(list);
}
and then listen to the read-only list
getReadOnlyList().addListener(listChangeListener);
Basically, I want to return the ObservableList list, which is synchronized with the original list, so that the user can register ListChangeListenerand observe the change events, but at the same time prevent the user from changing the original list.
source
share