public class FXCollections extends Object
Modifier and Type | Method and Description |
---|---|
static <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> |
emptyObservableList()
Creates and empty unmodifiable observable list.
|
static <K,V> ObservableMap<K,V> |
emptyObservableMap()
Creates and empty unmodifiable observable map.
|
static <E> ObservableSet<E> |
emptyObservableSet()
Creates and empty unmodifiable observable set.
|
static <T> void |
fill(ObservableList<? super T> list,
T obj)
Fills the provided list with obj.
|
static <E> ObservableList<E> |
observableArrayList()
Creates a new empty observable list that is backed by an arraylist.
|
static <E> ObservableList<E> |
observableArrayList(Callback<E,Observable[]> extractor)
Creates a new empty observable list backed by an arraylist.
|
static <E> ObservableList<E> |
observableArrayList(Collection<? extends E> col)
Creates a new observable array list and adds a content of collection
col
to it. |
static <E> ObservableList<E> |
observableArrayList(E... items)
Creates a new observable array list with
items added to it. |
static ObservableFloatArray |
observableFloatArray()
Creates a new empty observable float array.
|
static ObservableFloatArray |
observableFloatArray(float... values)
Creates a new observable float array with
values set to it. |
static ObservableFloatArray |
observableFloatArray(ObservableFloatArray array)
Creates a new observable float array with copy of elements in given
array . |
static <K,V> ObservableMap<K,V> |
observableHashMap()
Creates a new empty observable map that is backed by a HashMap.
|
static ObservableIntegerArray |
observableIntegerArray()
Creates a new empty observable integer array.
|
static ObservableIntegerArray |
observableIntegerArray(int... values)
Creates a new observable integer array with
values set to it. |
static ObservableIntegerArray |
observableIntegerArray(ObservableIntegerArray array)
Creates a new observable integer array with copy of elements in given
array . |
static <E> ObservableList<E> |
observableList(List<E> list)
Constructs an ObservableList that is backed by the specified list.
|
static <E> ObservableList<E> |
observableList(List<E> list,
Callback<E,Observable[]> extractor)
Constructs an ObservableList that is backed by the specified list.
|
static <K,V> ObservableMap<K,V> |
observableMap(Map<K,V> map)
Constructs an ObservableMap that is backed by the specified map.
|
static <E> ObservableSet<E> |
observableSet(E... elements)
Constructs an ObservableSet backed by a HashSet
that contains all the specified elements.
|
static <E> ObservableSet<E> |
observableSet(Set<E> set)
Constructs an ObservableSet that is backed by the specified set.
|
static <T> boolean |
replaceAll(ObservableList<T> list,
T oldVal,
T newVal)
Replace all oldVal elements in the list with newVal element.
|
static void |
reverse(ObservableList list)
Reverse the order in the list
Fires only one change notification on the list.
|
static void |
rotate(ObservableList list,
int distance)
Rotates the list by distance.
|
static void |
shuffle(ObservableList<?> list)
Shuffles all elements in the observable list.
|
static void |
shuffle(ObservableList list,
Random rnd)
Shuffles all elements in the observable list.
|
static <E> ObservableList<E> |
singletonObservableList(E e)
Creates an unmodifiable observable list with single element.
|
static <T extends Comparable<? super T>> |
sort(ObservableList<T> list)
Sorts the provided observable list.
|
static <T> void |
sort(ObservableList<T> list,
Comparator<? super T> c)
Sorts the provided observable list using the c comparator.
|
static <E> ObservableList<E> |
synchronizedObservableList(ObservableList<E> list)
Creates and returns a synchronized wrapper on top of provided observable list.
|
static <K,V> ObservableMap<K,V> |
synchronizedObservableMap(ObservableMap<K,V> map)
Creates and returns a synchronized wrapper on top of provided observable map.
|
static <E> ObservableSet<E> |
synchronizedObservableSet(ObservableSet<E> set)
Creates and returns a synchronized wrapper on top of provided observable set.
|
static <E> ObservableList<E> |
unmodifiableObservableList(ObservableList<E> list)
Creates and returns unmodifiable wrapper list on top of provided observable list.
|
static <K,V> ObservableMap<K,V> |
unmodifiableObservableMap(ObservableMap<K,V> map)
Constructs a read-only interface to the specified ObservableMap.
|
static <E> ObservableSet<E> |
unmodifiableObservableSet(ObservableSet<E> set)
Creates and returns unmodifiable wrapper on top of provided observable set.
|
public static <E> ObservableList<E> observableList(List<E> list)
list
- a concrete List that backs this ObservableListpublic static <E> ObservableList<E> observableList(List<E> list, Callback<E,Observable[]> extractor)
extractor
.
Observable objects returned by extractor (applied to each list element) are listened for changes
and transformed into "update" change of ListChangeListener.list
- a concrete List that backs this ObservableListextractor
- element to Observable[] convertorpublic static <K,V> ObservableMap<K,V> observableMap(Map<K,V> map)
map
- a Map that backs this ObservableMappublic static <E> ObservableSet<E> observableSet(Set<E> set)
set
- a Set that backs this ObservableSetpublic static <E> ObservableSet<E> observableSet(E... elements)
elements
- elements that will be added into returned ObservableSetpublic static <K,V> ObservableMap<K,V> unmodifiableObservableMap(ObservableMap<K,V> map)
map
- an ObservableMap that is to be monitored by this interfacepublic static <K,V> ObservableMap<K,V> checkedObservableMap(ObservableMap<K,V> map, Class<K> keyType, Class<V> valueType)
map
- an Observable map to be wrappedkeyType
- the type of key that map
is permitted to holdvalueType
- the type of value that map
is permitted to holdCollections#checkedMap(java.util.Map, java.lang.Class)
public static <K,V> ObservableMap<K,V> synchronizedObservableMap(ObservableMap<K,V> map)
map
- the map to be "wrapped" in a synchronized map.Collections.synchronizedMap(java.util.Map)
public static <K,V> ObservableMap<K,V> emptyObservableMap()
Collections.emptyMap()
public static ObservableIntegerArray observableIntegerArray()
public static ObservableIntegerArray observableIntegerArray(int... values)
values
set to it.values
- the values that will be in the new observable integer arraypublic static ObservableIntegerArray observableIntegerArray(ObservableIntegerArray array)
array
.array
- observable integer array to copypublic static ObservableFloatArray observableFloatArray()
public static ObservableFloatArray observableFloatArray(float... values)
values
set to it.values
- the values that will be in the new observable float arraypublic static ObservableFloatArray observableFloatArray(ObservableFloatArray array)
array
.array
- observable float array to copypublic static <E> ObservableList<E> observableArrayList()
observableList(java.util.List)
public static <E> ObservableList<E> observableArrayList(Callback<E,Observable[]> extractor)
extractor
- element to Observable[] convertor. Observable objects are listened for changes on the element.observableList(java.util.List, javafx.util.Callback)
public static <E> ObservableList<E> observableArrayList(E... items)
items
added to it.items
- the items that will be in the new observable ArrayListobservableArrayList()
public static <E> ObservableList<E> observableArrayList(Collection<? extends E> col)
col
to it.col
- a collection which content should be added to the observableArrayListpublic static <K,V> ObservableMap<K,V> observableHashMap()
K
- the type of keysV
- the type of valuespublic static <E> ObservableList<E> concat(ObservableList<E>... lists)
lists
- lists to concatenatepublic static <E> ObservableList<E> unmodifiableObservableList(ObservableList<E> list)
list
- an ObservableList that is to be wrappedCollections.unmodifiableList(java.util.List)
public static <E> ObservableList<E> checkedObservableList(ObservableList<E> list, Class<E> type)
list
- an Observable list to be wrappedtype
- the type of element that list is permitted to holdCollections.checkedList(java.util.List, java.lang.Class)
public static <E> ObservableList<E> synchronizedObservableList(ObservableList<E> list)
list
- the list to be "wrapped" in a synchronized list.Collections.synchronizedList(java.util.List)
public static <E> ObservableList<E> emptyObservableList()
Collections.emptyList()
public static <E> ObservableList<E> singletonObservableList(E e)
e
- the only elements that will be contained in this singleton observable listCollections.singletonList(java.lang.Object)
public static <E> ObservableSet<E> unmodifiableObservableSet(ObservableSet<E> set)
set
- an ObservableSet that is to be wrappedCollections.unmodifiableSet(java.util.Set)
public static <E> ObservableSet<E> checkedObservableSet(ObservableSet<E> set, Class<E> type)
set
- an Observable set to be wrappedtype
- the type of element that set is permitted to holdCollections.checkedSet(java.util.Set, java.lang.Class)
public static <E> ObservableSet<E> synchronizedObservableSet(ObservableSet<E> set)
set
- the set to be "wrapped" in a synchronized set.Collections.synchronizedSet(java.util.Set)
public static <E> ObservableSet<E> emptyObservableSet()
Collections.emptySet()
public static <T> void copy(ObservableList<? super T> dest, List<? extends T> src)
dest
- the destination observable listsrc
- the source listCollections.copy(java.util.List, java.util.List)
public static <T> void fill(ObservableList<? super T> list, T obj)
list
- the list to fillobj
- the object to fill the list withCollections.fill(java.util.List, java.lang.Object)
public static <T> boolean replaceAll(ObservableList<T> list, T oldVal, T newVal)
list
- the list which will have it's elements replacedoldVal
- the element that is going to be replacenewVal
- the replacementCollections.replaceAll(java.util.List, java.lang.Object, java.lang.Object)
public static void reverse(ObservableList list)
list
- the list to be reversedCollections.reverse(java.util.List)
public static void rotate(ObservableList list, int distance)
list
- the list to be rotateddistance
- the distance of rotationCollections.rotate(java.util.List, int)
public static void shuffle(ObservableList<?> list)
list
- the list to shuffleCollections.shuffle(java.util.List)
public static void shuffle(ObservableList list, Random rnd)
list
- the list to be shuffledrnd
- the random generator used for shufflingCollections.shuffle(java.util.List, java.util.Random)
public static <T extends Comparable<? super T>> void sort(ObservableList<T> list)
Collections.sort(java.util.List)
public static <T> void sort(ObservableList<T> list, Comparator<? super T> c)
list
- the list to sortc
- comparator used for sorting. Null if natural ordering is required.Collections.sort(java.util.List, java.util.Comparator)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.