Class SubscribableCollection<E>
java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingCollection<E>
nl.colorize.util.SubscribableCollection<E>
- Type Parameters:
E- The type of element included in this collection.
- All Implemented Interfaces:
Iterable<E>, Collection<E>
public class SubscribableCollection<E>
extends com.google.common.collect.ForwardingCollection<E>
Wraps an existing collection to allow subscribers to be notified whenever
elements are added to or removed from the collection.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidclear()protected Collection<E> delegate()flush()Removes all elements from this collection, then returns a stream containing the elements that were just removed.getFirst()iterator()Returns an iterator for the elements in the underlying collection.booleanbooleanremoveAll(Collection<?> toRemove) booleanretainAll(Collection<?> toRetain) toString()static <E> SubscribableCollection<E> wrap(Collection<E> elements) Returns a newSubscribableCollectioninstance that wraps the specified underlying collection.Methods inherited from class com.google.common.collect.ForwardingCollection
addAll, contains, containsAll, isEmpty, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRemoveAll, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArrayMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Method Details
-
delegate
- Specified by:
delegatein classcom.google.common.collect.ForwardingCollection<E>
-
add
- Specified by:
addin interfaceCollection<E>- Overrides:
addin classcom.google.common.collect.ForwardingCollection<E>
-
remove
- Specified by:
removein interfaceCollection<E>- Overrides:
removein classcom.google.common.collect.ForwardingCollection<E>
-
removeAll
- Specified by:
removeAllin interfaceCollection<E>- Overrides:
removeAllin classcom.google.common.collect.ForwardingCollection<E>
-
retainAll
- Specified by:
retainAllin interfaceCollection<E>- Overrides:
retainAllin classcom.google.common.collect.ForwardingCollection<E>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>- Overrides:
clearin classcom.google.common.collect.ForwardingCollection<E>
-
iterator
Returns an iterator for the elements in the underlying collection. The returned iterator will not supportIterator.remove(), even if the original collection does allow this. -
getFirst
-
flush
-
toString
- Overrides:
toStringin classcom.google.common.collect.ForwardingObject
-
wrap
Returns a newSubscribableCollectioninstance that wraps the specified underlying collection. -
getAddedElements
-
getRemovedElements
-