E - the type of elements maintained by this setpublic class ConcurrentHashSet<E> extends Object implements ConcurrentSet<E>
| Constructor and Description |
|---|
ConcurrentHashSet()
Creates a new, empty set with a default initial capacity (16), load factor (0.75) and
concurrencyLevel (16).
|
ConcurrentHashSet(Collection<? extends E> c)
Creates a new set with the same entries as the given collection.
|
ConcurrentHashSet(int initialCapacity)
Creates a new, empty set with the specified initial capacity, and with default load factor
(0.75) and concurrencyLevel (16).
|
ConcurrentHashSet(int initialCapacity,
float loadFactor)
Creates a new, empty set with the specified initial capacity and load factor and with the
default concurrencyLevel (16).
|
ConcurrentHashSet(int initialCapacity,
float loadFactor,
int concurrencyLevel)
Creates a new, empty set with the specified initial capacity, load factor and concurrency level.
|
| Modifier and Type | Method and Description |
|---|---|
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() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
public ConcurrentHashSet()
public ConcurrentHashSet(int initialCapacity)
initialCapacity - the initial capacity. The implementation performs internal sizing to
accommodate this many elements.public ConcurrentHashSet(int initialCapacity,
float loadFactor)
initialCapacity - the initial capacity. The implementation performs internal sizing to
accommodate this many elements.loadFactor - the load factor threshold, used to control resizing. Resizing may be performed
when the average number of elements per bin exceeds this threshold.public ConcurrentHashSet(int initialCapacity,
float loadFactor,
int concurrencyLevel)
initialCapacity - the initial capacity. The implementation performs internal sizing to
accommodate this many elements.loadFactor - the load factor threshold, used to control resizing. Resizing may be performed
when the average number of elements per bin exceeds this threshold.concurrencyLevel - the estimated number of concurrently updating threads. The implementation
performs internal sizing to try to accommodate this many threads.public ConcurrentHashSet(Collection<? extends E> c)
c - the collectionpublic int size()
public boolean isEmpty()
public boolean contains(Object o)
public Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(E e)
public boolean remove(Object o)
public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface Set<E>public boolean addAll(Collection<? extends E> c)
public boolean retainAll(Collection<?> c)
public boolean removeAll(Collection<?> c)
Copyright © 2011-2013. All Rights Reserved.