Package com.atlassian.bamboo.concurrent
Class BoundedSet<E>
java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingCollection<E>
com.google.common.collect.ForwardingSet<E>
com.atlassian.bamboo.concurrent.BoundedSet<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>
public class BoundedSet<E>
extends com.google.common.collect.ForwardingSet<E>
A bounded set. Set additions are blocked if set capacity is exceeded.
-
Constructor Summary
ConstructorsConstructorDescriptionBoundedSet(int maximumSize) Creates aHashSet-backed bounded set.BoundedSet(Set<E> delegate, int maximumSize) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(@NotNull Collection<? extends E> c) voidclear()delegate()iterator()The returned iterator does not support removal.booleanInserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions.poll()SeeQueue.poll()Retrieves and removes the head of this queue, or returnsnullif this queue is empty.booleanbooleanremoveAll(@NotNull Collection<?> c) booleanretainAll(@NotNull Collection<?> c) Methods inherited from class com.google.common.collect.ForwardingSet
equals, hashCode, standardEquals, standardHashCode, standardRemoveAllMethods inherited from class com.google.common.collect.ForwardingCollection
contains, containsAll, isEmpty, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArrayMethods inherited from class com.google.common.collect.ForwardingObject
toStringMethods 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 java.util.Set
contains, containsAll, isEmpty, size, spliterator, toArray, toArray
-
Constructor Details
-
BoundedSet
-
BoundedSet
public BoundedSet(int maximumSize) Creates aHashSet-backed bounded set.
-
-
Method Details
-
delegate
- Specified by:
delegatein classcom.google.common.collect.ForwardingSet<E>
-
iterator
The returned iterator does not support removal. -
add
-
remove
-
addAll
-
retainAll
-
removeAll
-
clear
public void clear() -
poll
SeeQueue.poll()Retrieves and removes the head of this queue, or returnsnullif this queue is empty. WARNING: unlike Queue's poll() there is no guarantee that the items will be polled in the same order as added. -
offer
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions.- Returns:
- true if the contains(e) will return true after this operation.
-