Top Description Inners Fields Constructors Methods
javafx.collections

public Class FXCollections

extends Object
Class Inheritance
Imports
com.sun.javafx.collections.ListListenerHelper, .MapListenerHelper, .SetListenerHelper, .ObservableListWrapper, .ObservableMapWrapper, .ObservableSetWrapper, .MapAdapterChange, .ObservableFloatArrayImpl, .ObservableIntegerArrayImpl, .ObservableSequentialListWrapper, .SetAdapterChange, .SortableList, .SourceAdapterChange, java.lang.reflect.Array, java.util.AbstractList, .AbstractMap, .AbstractSet, .ArrayList, .Arrays, .Collection, .Collections, .Comparator, .HashMap, .HashSet, .Iterator, .List, .ListIterator, .Map, .NoSuchElementException, .Random, .Set, .RandomAccess, javafx.beans.InvalidationListener, .Observable, javafx.util.Callback

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.
Since
JavaFX 2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final ObservableList<?>
private static final ObservableMap<?, ?>
private static final ObservableSet<?>
private static Random
r

Constructor Summary

AccessConstructor and Description
private
FXCollections()

Not to be instantiated.

Method Summary

Modifier and TypeMethod and Description
public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

a dynamically typesafe view of the specified list
checkedObservableList
(ObservableList<E>
an Observable list to be wrapped
list
,
Class<E>
the type of element that list is permitted to hold
type
)

Creates and returns a typesafe wrapper on top of provided observable list.

public static <
the type of the wrapped key
K
,
the type of the wrapped value
V
>
ObservableMap<K, V>

Returns:

a dynamically typesafe view of the specified map
checkedObservableMap
(ObservableMap<K, V>
an Observable map to be wrapped
map
,
Class<K>
the type of key that map is permitted to hold
keyType
,
Class<V>
the type of value that map is permitted to hold
valueType
)

Creates and returns a typesafe wrapper on top of provided observable map.

public static <
The type of List to be wrapped
E
>
ObservableSet<E>

Returns:

a dynamically typesafe view of the specified set
checkedObservableSet
(ObservableSet<E>
an Observable set to be wrapped
set
,
Class<E>
the type of element that set is permitted to hold
type
)

Creates and returns a typesafe wrapper on top of provided observable set.

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

new observable array list concatenated from the arguments
concat
(ObservableList<E>...
lists to concatenate
lists
)

Concatenates more observable lists into one.

public static <
The type of List to be wrapped
T
>
void
copy(ObservableList<? super T>
the destination observable list
dest
,
List<? extends T>
the source list
src
)

Copies elements from src to dest.

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

An empty unmodifiable observable list
emptyObservableList
()

Creates an empty unmodifiable observable list.

public static <
the type of the wrapped key
K
,
the type of the wrapped value
V
>
ObservableMap<K, V>

Returns:

An empty unmodifiable observable map
emptyObservableMap
()

Creates an empty unmodifiable observable map.

public static <
The type of List to be wrapped
E
>
ObservableSet<E>

Returns:

An empty unmodifiable observable set
emptyObservableSet
()

Creates an empty unmodifiable observable set.

public static <
The type of List to be wrapped
T
>
void
fill(ObservableList<? super T>
the list to fill
list
,
T
the object to fill the list with
obj
)

Fills the provided list with obj.

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

a newly created ObservableList
observableArrayList
()

Creates a new empty observable list that is backed by an array list.

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

a newly created ObservableList
observableArrayList
(Callback<E, Observable[]>
element to Observable[] converter
extractor
)

Creates a new empty ObservableList that is backed by an array list and listens to changes in observables of its items.

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

a newly created observableArrayList
observableArrayList
(E...
the items that will be in the new observable ArrayList
items
)

Creates a new observable array list with items added to it.

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

a newly created observableArrayList
observableArrayList
(Collection<? extends E>
a collection which content should be added to the observableArrayList
col
)

Creates a new observable array list and adds a content of collection col to it.

public static ObservableFloatArray

Returns:

a newly created ObservableFloatArray
observableFloatArray
()

Creates a new empty observable float array.

public static ObservableFloatArray

Returns:

a newly created ObservableFloatArray
observableFloatArray
(float...
the values that will be in the new observable float array
values
)

Creates a new observable float array with values set to it.

public static ObservableFloatArray

Returns:

a newly created ObservableFloatArray
observableFloatArray
(ObservableFloatArray
observable float array to copy
array
)

Creates a new observable float array with copy of elements in given array.

public static <
the type of the wrapped key
K
,
the type of the wrapped value
V
>
ObservableMap<K, V>

Returns:

a newly created observable HashMap
observableHashMap
()

Creates a new empty observable map that is backed by a HashMap.

public static ObservableIntegerArray

Returns:

a newly created ObservableIntegerArray
observableIntegerArray
()

Creates a new empty observable integer array.

public static ObservableIntegerArray

Returns:

a newly created ObservableIntegerArray
observableIntegerArray
(int...
the values that will be in the new observable integer array
values
)

Creates a new observable integer array with values set to it.

public static ObservableIntegerArray

Returns:

a newly created ObservableIntegerArray
observableIntegerArray
(ObservableIntegerArray
observable integer array to copy
array
)

Creates a new observable integer array with copy of elements in given array.

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

a newly created ObservableList
observableList
(List<E>
a concrete List that backs this ObservableList
list
)

Constructs an ObservableList that is backed by the specified list.

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

a newly created ObservableList
observableList
(List<E>
a concrete List that backs this ObservableList
list
,
Callback<E, Observable[]>
element to Observable[] converter
extractor
)

Constructs an ObservableList that is backed by the specified list and listens to changes in observables of its items.

public static <
the type of the wrapped key
K
,
the type of the wrapped value
V
>
ObservableMap<K, V>

Returns:

a newly created ObservableMap
observableMap
(Map<K, V>
a Map that backs this ObservableMap
map
)

Constructs an ObservableMap that is backed by the specified map.

public static <
The type of List to be wrapped
E
>
ObservableSet<E>

Returns:

a newly created ObservableSet
observableSet
(Set<E>
a Set that backs this ObservableSet
set
)

Constructs an ObservableSet that is backed by the specified set.

public static <
The type of List to be wrapped
E
>
ObservableSet<E>

Returns:

a newly created ObservableSet
observableSet
(E...
elements that will be added into returned ObservableSet
elements
)

Constructs an ObservableSet backed by a HashSet that contains all the specified elements.

public static <
The type of List to be wrapped
T
>
boolean

Returns:

true if the list was modified
replaceAll
(ObservableList<T>
the list which will have it's elements replaced
list
,
T
the element that is going to be replace
oldVal
,
T
the replacement
newVal
)

Replace all oldVal elements in the list with newVal element.

public static void
reverse(ObservableList<E>
the list to be reversed
list
)

Reverses the order in the list.

public static void
rotate(ObservableList<E>
the list to be rotated
list
,
int
the distance of rotation
distance
)

Rotates the list by distance.

public static void
shuffle(ObservableList<?>
the list to shuffle
list
)

Shuffles all elements in the observable list.

public static void
shuffle(ObservableList<E>
the list to be shuffled
list
,
Random
the random generator used for shuffling
rnd
)

Shuffles all elements in the observable list.

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

a singleton observable list
singletonObservableList
(E
the only elements that will be contained in this singleton observable list
e
)

Creates an unmodifiable observable list with single element.

public static <
the type of elements in this list
T extends Comparable<? super T>
>
void
sort(ObservableList<T>
the list to be sorted
list
)

Sorts the provided observable list as specified in Collections.sort(List).

public static <
the type of elements in this list
T
>
void
sort(ObservableList<T>
the list to sort
list
,
Comparator<? super T>
the comparator to determine the order of the list. A null value indicates that the elements' natural ordering should be used.
comparator
)

Sorts the provided observable list as specified in Collections.sort(List, Comparator).

private static void
swap(Object[] arr, int i, int j)

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

A synchronized version of the observable list
synchronizedObservableList
(ObservableList<E>
the list to be "wrapped" in a synchronized list.
list
)

Creates and returns a synchronized wrapper on top of provided observable list.

public static <
the type of the wrapped key
K
,
the type of the wrapped value
V
>
ObservableMap<K, V>

Returns:

A synchronized version of the observable map
synchronizedObservableMap
(ObservableMap<K, V>
the map to be "wrapped" in a synchronized map.
map
)

Creates and returns a synchronized wrapper on top of provided observable map.

public static <
The type of List to be wrapped
E
>
ObservableSet<E>

Returns:

A synchronized version of the observable set
synchronizedObservableSet
(ObservableSet<E>
the set to be "wrapped" in a synchronized set.
set
)

Creates and returns a synchronized wrapper on top of provided observable set.

public static <
The type of List to be wrapped
E
>
ObservableList<E>

Returns:

an ObserableList wrapper that is unmodifiable
unmodifiableObservableList
(ObservableList<E>
an ObservableList that is to be wrapped
list
)

Creates and returns unmodifiable wrapper list on top of provided observable list.

public static <
the type of the wrapped key
K
,
the type of the wrapped value
V
>
ObservableMap<K, V>

Returns:

a newly created UnmodifiableObservableMap
unmodifiableObservableMap
(ObservableMap<K, V>
an ObservableMap that is to be monitored by this interface
map
)

Constructs a read-only interface to the specified ObservableMap.

public static <
The type of List to be wrapped
E
>
ObservableSet<E>

Returns:

an ObserableSet wrapper that is unmodifiable
unmodifiableObservableSet
(ObservableSet<E>
an ObservableSet that is to be wrapped
set
)

Creates and returns unmodifiable wrapper on top of provided observable set.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait