Package com.atlassian.bamboo.concurrent
Class BlockingSet<E>
- java.lang.Object
-
- com.atlassian.bamboo.concurrent.BlockingSet<E>
-
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
public class BlockingSet<E> extends Object implements Set<E>
It fulfills the general Set contract, with one important difference: if an equal element already exists, insertion of an element is blocked until it can be inserted. The implementation is HashSet backed and thread-safe.
-
-
Constructor Summary
Constructors Constructor Description BlockingSet()
-
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()
boolean
contains(Object o)
boolean
containsAll(@NotNull Collection<?> c)
boolean
isEmpty()
@NotNull Iterator<E>
iterator()
The returned iterator does not support removal.boolean
remove(Object o)
boolean
removeAll(@NotNull Collection<?> c)
boolean
retainAll(@NotNull Collection<?> c)
int
size()
@NotNull Object[]
toArray()
<T> @NotNull T[]
toArray(@NotNull T[] a)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
-
-
-
Method Detail
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(Object o)
-
iterator
@NotNull public @NotNull Iterator<E> iterator()
The returned iterator does not support removal.
-
toArray
@NotNull public @NotNull Object[] toArray()
-
toArray
@NotNull public <T> @NotNull T[] toArray(@NotNull @NotNull T[] a)
-
containsAll
public boolean containsAll(@NotNull @NotNull Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceSet<E>
-
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)
-
-