public class ConcurrentHashSet<E>
extends java.util.AbstractSet<E>
implements java.io.Serializable
ConcurrentHashMap to deal with the fact that the
JDK does not have a proper concurrent Set implementation that uses efficient lock striping.
Note that values are stored as keys in the underlying Map, with a static dummy object as value.| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.ConcurrentMap<E,java.lang.Object> |
map |
| Constructor and Description |
|---|
ConcurrentHashSet() |
ConcurrentHashSet(int concurrencyLevel) |
ConcurrentHashSet(int initSize,
float loadFactor,
int concurrencyLevel)
Params passed in to the underlying CHM.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E o) |
boolean |
addAll(java.util.Collection<? extends E> c) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
protected final java.util.concurrent.ConcurrentMap<E,java.lang.Object> map
public ConcurrentHashSet()
public ConcurrentHashSet(int concurrencyLevel)
concurrencyLevel - passed in to the underlying CHM. See ConcurrentHashMap.ConcurrentHashMap(int,
float, int) javadocs for details.public ConcurrentHashSet(int initSize,
float loadFactor,
int concurrencyLevel)
ConcurrentHashMap.ConcurrentHashMap(int,
float, int) javadocs for details.public int size()
public boolean isEmpty()
public boolean contains(java.lang.Object o)
public java.util.Iterator<E> iterator()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(E o)
public boolean remove(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean addAll(java.util.Collection<? extends E> c)
public boolean retainAll(java.util.Collection<?> c)
public boolean removeAll(java.util.Collection<?> c)