Package net.sf.jstuff.core.collection
Class ObservableSet<E>
java.lang.Object
net.sf.jstuff.core.collection.ObservableCollection<E,Set<E>>
net.sf.jstuff.core.collection.ObservableSet<E>
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
,CollectionExt<E>
,EventListenable<ObservableCollection.ChangeEvent<E>>
A
Set
wrapper that emits change events when modified through this ObservableSet
.
Changes made directly to the underlying Set
instance are not observable and will not trigger events.
Change events include item-level details, and may include index information if the underlying set has a defined or stable iteration order:
- For sets with insertion order (e.g.
LinkedHashSet
), added and removed items include their index. - For sets with stable iteration order (e.g.
SortedSet
), only removed items include their index. - For unordered sets (e.g.
HashSet
), indices are set toObservableCollection.UNKNOWN_INDEX
.
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
ConstructorsConstructorDescriptionObservableSet
(Set<E> set) ObservableSet
(Set<E> set, EventDispatcher<ObservableCollection.ChangeEvent<E>> dispatcher) -
Method Summary
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, removeMatching, 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
containsIdentical, isNotEmpty, removeIfNot
Methods inherited from interface net.sf.jstuff.core.event.EventListenable
subscribe