dsto.dfc.collections
Class ConcurrentHashSet<K>

java.lang.Object
  extended by dsto.dfc.collections.ConcurrentHashSet<K>
All Implemented Interfaces:
Iterable<K>, Collection<K>, Set<K>

public class ConcurrentHashSet<K>
extends Object
implements Set<K>

Concurrent hash set built on ConcurrentHashMap. Not sure why Java doesn't ship with one of these already. Shamelessly cribbed from JBoss's Shotoku project.

Author:
Adam Warski (adamw@aster.pl)

Constructor Summary
ConcurrentHashSet()
           
 
Method Summary
 boolean add(K o)
           
 boolean addAll(Collection<? extends K> c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 boolean isEmpty()
           
 Iterator<K> iterator()
           
 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

ConcurrentHashSet

public ConcurrentHashSet()
Method Detail

size

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

isEmpty

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

contains

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

iterator

public Iterator<K> iterator()
Specified by:
iterator in interface Iterable<K>
Specified by:
iterator in interface Collection<K>
Specified by:
iterator in interface Set<K>

toArray

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

toArray

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

add

public boolean add(K o)
Specified by:
add in interface Collection<K>
Specified by:
add in interface Set<K>

remove

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

containsAll

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

addAll

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

retainAll

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

removeAll

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

clear

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


Copyright © 2008 Commonwealth of Australia