E - the type of elements maintained by this setpublic class ConcurrentHashSet<E> extends Object implements ConcurrentSet<E>, Serializable
| 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> collection)
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 elem) |
boolean |
addAll(Collection<? extends E> collection) |
void |
clear() |
boolean |
contains(Object obj) |
boolean |
containsAll(Collection<?> collection) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
boolean |
remove(Object obj) |
boolean |
removeAll(Collection<?> collection) |
boolean |
retainAll(Collection<?> collection) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] array) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, hashCode, spliteratorparallelStream, removeIf, streampublic 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> collection)
collection - the collectionpublic int size()
public boolean isEmpty()
public boolean contains(Object obj)
public Object[] toArray()
public <T> T[] toArray(T[] array)
public boolean add(E elem)
public boolean remove(Object obj)
public boolean containsAll(Collection<?> collection)
containsAll in interface Collection<E>containsAll in interface Set<E>public boolean addAll(Collection<? extends E> collection)
public boolean retainAll(Collection<?> collection)
public boolean removeAll(Collection<?> collection)
Copyright © 2011-2015. All Rights Reserved.