public static void main(String[] args) { ListProperty<String> lp1 = new SimpleListProperty<>(FXCollections.observableArrayList()); ListProperty<String> lp2 = new SimpleListProperty<>(FXCollections.observableArrayList()); lp1.bind(lp2); print("Before addAll():", lp1, lp2); lp1.addAll("One", "Two"); print("After addAll():", lp1, lp2); // Change the reference of the ObservableList in lp2 lp2.set(FXCollections.observableArrayList("1", "2")); print("After lp2.set():", lp1, lp2); // Cannot do the following as lp1 is a bound property // lp1.set(FXCollections.observableArrayList("1", "2")); // Unbind lp1 lp1.unbind(); print("After unbind():", lp1, lp2); // Bind lp1 and lp2 bidirectionally lp1.bindBidirectional(lp2); print("After bindBidirectional():", lp1, lp2); lp1.set(FXCollections.observableArrayList("X", "Y")); print("After lp1.set():", lp1, lp2); }
public Stack(final List<T> list) { if (list == null) { throw new IllegalArgumentException("Cannot create stack from list: argument is null."); } elementsProperty.set(FXCollections.observableList(list)); }
public Stack(final Stack<T> otherStack) { if (otherStack == null) { throw new IllegalArgumentException("Cannot create stack from stack: argument is null."); } elementsProperty.set(FXCollections.observableList(otherStack.toList())); }
public Stack() { elementsProperty.set(FXCollections.observableList(new ArrayList<>())); }