Package com.sun.javafx.collections
Class ImmutableObservableList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
com.sun.javafx.collections.ImmutableObservableList<E>
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,List<E>
,Observable
,ObservableList<E>
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
A convenient method for var-arg adding of elements.void
addListener
(InvalidationListener listener) Adds anInvalidationListener
which will be notified whenever theObservable
becomes invalid.void
addListener
(ListChangeListener<? super E> listener) Add a listener to this observable list.get
(int index) void
remove
(int from, int to) Basically a shortcut to sublist(from, to).clear() As this is a common operation, ObservableList has this method for convenient usage.boolean
A convenient method for var-arg usage of removaAll method.void
removeListener
(InvalidationListener listener) Removes the given listener from the list of listeners, that are notified whenever the value of theObservable
becomes invalid.void
removeListener
(ListChangeListener<? super E> listener) Tries to removed a listener from this observable list.boolean
A convenient method for var-arg usage of retain method.boolean
Clears the ObservableList and add all the elements passed as var-args.boolean
setAll
(Collection<? extends E> col) Clears the ObservableList and add all elements from the collection.int
size()
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, subList, toArray, toArray
Methods inherited from interface javafx.collections.ObservableList
filtered, sorted
-
Constructor Details
-
ImmutableObservableList
-
-
Method Details
-
addListener
Description copied from interface:Observable
Adds anInvalidationListener
which will be notified whenever theObservable
becomes invalid. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.Note that the same actual
InvalidationListener
instance may be safely registered for differentObservables
.The
Observable
stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by callingremoveListener
after use or to use an instance ofWeakInvalidationListener
avoid this situation.- Specified by:
addListener
in interfaceObservable
- Parameters:
listener
- The listener to register- See Also:
-
removeListener
Description copied from interface:Observable
Removes the given listener from the list of listeners, that are notified whenever the value of theObservable
becomes invalid.If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.
- Specified by:
removeListener
in interfaceObservable
- Parameters:
listener
- The listener to remove- See Also:
-
addListener
Description copied from interface:ObservableList
Add a listener to this observable list.- Specified by:
addListener
in interfaceObservableList<E>
- Parameters:
listener
- the listener for listening to the list changes
-
removeListener
Description copied from interface:ObservableList
Tries to removed a listener from this observable list. If the listener is not attached to this list, nothing happens.- Specified by:
removeListener
in interfaceObservableList<E>
- Parameters:
listener
- a listener to remove
-
addAll
Description copied from interface:ObservableList
A convenient method for var-arg adding of elements.- Specified by:
addAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to add- Returns:
- true (as specified by Collection.add(E))
-
setAll
Description copied from interface:ObservableList
Clears the ObservableList and add all the elements passed as var-args.- Specified by:
setAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to set- Returns:
- true (as specified by Collection.add(E))
-
setAll
Description copied from interface:ObservableList
Clears the ObservableList and add all elements from the collection.- Specified by:
setAll
in interfaceObservableList<E>
- Parameters:
col
- the collection with elements that will be added to this observableArrayList- Returns:
- true (as specified by Collection.add(E))
-
removeAll
Description copied from interface:ObservableList
A convenient method for var-arg usage of removaAll method.- Specified by:
removeAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to be removed- Returns:
- true if list changed as a result of this call
-
retainAll
Description copied from interface:ObservableList
A convenient method for var-arg usage of retain method.- Specified by:
retainAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to be retained- Returns:
- true if list changed as a result of this call
-
remove
public void remove(int from, int to) Description copied from interface:ObservableList
Basically a shortcut to sublist(from, to).clear() As this is a common operation, ObservableList has this method for convenient usage.- Specified by:
remove
in interfaceObservableList<E>
- Parameters:
from
- the start of the range to remove (inclusive)to
- the end of the range to remove (exclusive)
-
get
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceList<E>
- Specified by:
size
in classAbstractCollection<E>
-