Class FXCollections
java.lang.Object
javafx.collections.FXCollections
Utility class that consists of static methods that are 1:1 copies of java.util.Collections methods.
The wrapper methods (like synchronizedObservableList or emptyObservableList) has exactly the same functionality as the methods in Collections, with exception that they return ObservableList and are therefore suitable for methods that require ObservableList on input.
The utility methods are here mainly for performance reasons. All methods are optimized in a way that they yield only limited number of notifications. On the other hand, java.util.Collections methods might call "modification methods" on an ObservableList multiple times, resulting in a number of notifications.
The wrapper methods (like synchronizedObservableList or emptyObservableList) has exactly the same functionality as the methods in Collections, with exception that they return ObservableList and are therefore suitable for methods that require ObservableList on input.
The utility methods are here mainly for performance reasons. All methods are optimized in a way that they yield only limited number of notifications. On the other hand, java.util.Collections methods might call "modification methods" on an ObservableList multiple times, resulting in a number of notifications.
- Since:
- JavaFX 2.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> ObservableList
<E> checkedObservableList
(ObservableList<E> list, Class<E> type) Creates and returns a typesafe wrapper on top of provided observable list.static <K,
V> ObservableMap <K, V> checkedObservableMap
(ObservableMap<K, V> map, Class<K> keyType, Class<V> valueType) Creates and returns a typesafe wrapper on top of provided observable map.static <E> ObservableSet
<E> checkedObservableSet
(ObservableSet<E> set, Class<E> type) Creates and returns a typesafe wrapper on top of provided observable set.static <E> ObservableList
<E> concat
(ObservableList<E>... lists) Concatenates more observable lists into one.static <T> void
copy
(ObservableList<? super T> dest, List<? extends T> src) Copies elements from src to dest.static <E> ObservableList
<E> Creates an empty unmodifiable observable list.static <K,
V> ObservableMap <K, V> Creates an empty unmodifiable observable map.static <E> ObservableSet
<E> Creates an empty unmodifiable observable set.static <T> void
fill
(ObservableList<? super T> list, T obj) Fills the provided list with obj.static <E> ObservableList
<E> Creates a new empty observable list that is backed by an array list.static <E> ObservableList
<E> observableArrayList
(E... items) Creates a new observable array list withitems
added to it.static <E> ObservableList
<E> observableArrayList
(Collection<? extends E> col) Creates a new observable array list and adds a content of collectioncol
to it.static <E> ObservableList
<E> observableArrayList
(Callback<E, Observable[]> extractor) Creates a new emptyObservableList
that is backed by an array list and listens to changes in observables of its items.static ObservableFloatArray
Creates a new empty observable float array.static ObservableFloatArray