Package net.sf.jstuff.core.collection
Class ObservableList<E>
java.lang.Object
net.sf.jstuff.core.collection.ObservableCollection<E,List<E>>
net.sf.jstuff.core.collection.ObservableList<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,CollectionExt<E>,ListExt<E>,EventListenable<ObservableCollection.ChangeEvent<E>>
A
List wrapper that emits change events when modified through this ObservableList.
Changes made directly to the underlying List instance are not observable and will not trigger events.
Change events include index information.
Listeners can subscribe to receive change events describing the type of change and the affected items.
- Author:
- Sebastian Thomschke
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.jstuff.core.collection.ObservableCollection
ObservableCollection.ChangeEvent<E> -
Field Summary
Fields inherited from class net.sf.jstuff.core.collection.ObservableCollection
events, supportsInsertionIndex, supportsRemovalIndex, UNKNOWN_INDEX, wrapped -
Constructor Summary
ConstructorsConstructorDescriptionObservableList(List<E> list) ObservableList(List<E> list, EventDispatcher<ObservableCollection.ChangeEvent<E>> dispatcher) -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanaddAll(int index, Collection<? extends E> itemsToAdd) get(int index) intintlastIndexOf(@Nullable Object item) listIterator(int index) static <E> ObservableList<E>remove(int index) booleanprotected booleanremoveMatching(Predicate<? super E> shouldRemove, ObservableCollection.ChangeEvent.Operation action) voidreplaceAll(UnaryOperator<E> operator) subList(int fromIndex, int toIndex) Methods inherited from class net.sf.jstuff.core.collection.ObservableCollection
add, addAll, addAll, addAll, addAll, addAll, addAll, addAll, clear, clearInternal, contains, containsAll, equals, fire, fire, hashCode, isEmpty, iterator, removeAll, removeAll, removeIf, retainAll, retainAll, size, subscribe, toArray, toArray, toString, unsubscribeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface net.sf.jstuff.core.collection.ext.CollectionExt
addAll, addAll, addAll, addAll, addAll, addAll, containsIdentical, isNotEmpty, removeIfNotMethods inherited from interface net.sf.jstuff.core.event.EventListenable
subscribeMethods inherited from interface java.util.List
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, sort, spliterator, toArray, toArrayMethods inherited from interface net.sf.jstuff.core.collection.ext.ListExt
findFirst, findFirstMatching, findLast, getAt, getAtOrDefault, getLast, removeLast, setAt
-
Constructor Details
-
ObservableList
-
ObservableList
public ObservableList(List<E> list, EventDispatcher<ObservableCollection.ChangeEvent<E>> dispatcher)
-
-
Method Details
-
of
-
add
-
addAll
-
get
-
indexOf
-
replaceAll
- Specified by:
replaceAllin interfaceList<E>
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
removeMatching
protected boolean removeMatching(Predicate<? super E> shouldRemove, ObservableCollection.ChangeEvent.Operation action) - Overrides:
removeMatchingin classObservableCollection<E,List<E>>
-
remove
-
remove
-
set
-
subList
-