Package nl.colorize.util
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 TypeMethodDescriptionboolean
void
clear()
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.boolean
boolean
removeAll
(Collection<?> toRemove) boolean
retainAll
(Collection<?> toRetain) toString()
static <E> SubscribableCollection
<E> wrap
(Collection<E> elements) Returns a newSubscribableCollection
instance 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, toArray
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Method Details
-
delegate
- Specified by:
delegate
in classcom.google.common.collect.ForwardingCollection<E>
-
add
- Specified by:
add
in interfaceCollection<E>
- Overrides:
add
in classcom.google.common.collect.ForwardingCollection<E>
-
remove
- Specified by:
remove
in interfaceCollection<E>
- Overrides:
remove
in classcom.google.common.collect.ForwardingCollection<E>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<E>
- Overrides:
removeAll
in classcom.google.common.collect.ForwardingCollection<E>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<E>
- Overrides:
retainAll
in classcom.google.common.collect.ForwardingCollection<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Overrides:
clear
in 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
Removes all elements from this collection, then returns a stream containing the elements that were just removed. -
toString
- Overrides:
toString
in classcom.google.common.collect.ForwardingObject
-
wrap
Returns a newSubscribableCollection
instance that wraps the specified underlying collection. -
getAddedElements
-
getRemovedElements
-