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 TypeMethodDescriptionvoid
boolean
addAll
(int index, Collection<? extends E> itemsToAdd) get
(int index) int
int
lastIndexOf
(@Nullable Object item) listIterator
(int index) static <E> ObservableList<E>
remove
(int index) boolean
protected boolean
removeMatching
(Predicate<? super E> shouldRemove, ObservableCollection.ChangeEvent.Operation action) void
replaceAll
(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, unsubscribe
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, toArray
Methods inherited from interface net.sf.jstuff.core.collection.ext.CollectionExt
addAll, addAll, addAll, addAll, addAll, addAll, containsIdentical, isNotEmpty, removeIfNot
Methods inherited from interface net.sf.jstuff.core.event.EventListenable
subscribe
Methods inherited from interface java.util.List
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, sort, spliterator, toArray, toArray
Methods 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:
replaceAll
in interfaceList<E>
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
-
removeMatching
protected boolean removeMatching(Predicate<? super E> shouldRemove, ObservableCollection.ChangeEvent.Operation action) - Overrides:
removeMatching
in classObservableCollection<E,
List<E>>
-
remove
-
remove
-
set
-
subList
-