com.atlassian.bamboo.concurrent
Class BlockingSet<E>

java.lang.Object
  extended by 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
BlockingSet()
           
 
Method Summary
 boolean add(E e)
           
 boolean addAll(Collection<? extends E> c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 boolean isEmpty()
           
 Iterator<E> iterator()
          The returned iterator does not support removal.
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(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.Set
equals, hashCode
 

Constructor Detail

BlockingSet

public BlockingSet()
Method Detail

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in interface Set<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface Set<E>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface Set<E>

iterator

@NotNull
public Iterator<E> iterator()
The returned iterator does not support removal.

Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>

toArray

@NotNull
public Object[] toArray()
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

toArray

@NotNull
public <T> T[] toArray(@NotNull
                               T[] a)
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

containsAll

public boolean containsAll(@NotNull
                           Collection<?> c)
Specified by:
containsAll in interface Collection<E>
Specified by:
containsAll in interface Set<E>

add

public boolean add(E e)
Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>

addAll

public boolean addAll(@NotNull
                      Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface Set<E>

retainAll

public boolean retainAll(@NotNull
                         Collection<?> c)
Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>

removeAll

public boolean removeAll(@NotNull
                         Collection<?> c)
Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.