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
Constructors Constructor Description BoundedSet(int maximumSize)
Creates aHashSet
-backed bounded set.BoundedSet(Set<E> delegate, int maximumSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E e)
boolean
addAll(@NotNull Collection<? extends E> c)
void
clear()
protected Set<E>
delegate()
@NotNull Iterator<E>
iterator()
The returned iterator does not support removal.boolean
offer(E e)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions.E
poll()
SeeQueue.poll()
Retrieves and removes the head of this queue, or returnsnull
if this queue is empty.boolean
remove(Object o)
boolean
removeAll(@NotNull Collection<?> c)
boolean
retainAll(@NotNull Collection<?> c)
-
Methods inherited from class com.google.common.collect.ForwardingSet
equals, hashCode, standardEquals, standardHashCode, standardRemoveAll
-
Methods inherited from class com.google.common.collect.ForwardingCollection
contains, containsAll, isEmpty, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArray
-
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 java.util.Set
contains, containsAll, isEmpty, size, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
delegate
protected Set<E> delegate()
- Specified by:
delegate
in classcom.google.common.collect.ForwardingSet<E>
-
iterator
@NotNull public @NotNull Iterator<E> iterator()
The returned iterator does not support removal.
-
add
public boolean add(E e)
-
remove
public boolean remove(Object o)
-
addAll
public boolean addAll(@NotNull @NotNull Collection<? extends E> c)
-
retainAll
public boolean retainAll(@NotNull @NotNull Collection<?> c)
-
removeAll
public boolean removeAll(@NotNull @NotNull Collection<?> c)
-
clear
public void clear()
-
poll
@Nullable public E poll()
SeeQueue.poll()
Retrieves and removes the head of this queue, or returnsnull
if 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
public boolean offer(E e)
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.
-
-