|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<E>
edu.memphis.ccrg.lida.framework.shared.ConcurrentHashSet<E>
E
- The generic type to use in this HashSetpublic class ConcurrentHashSet<E>
Thread-safe HashSet
based on a ConcurrentHashMap
Constructor Summary | |
---|---|
ConcurrentHashSet()
Constructs a new, empty set; the backing ConcurrentHashMap has default initial capacity, load factor, and concurrencyLevel. |
|
ConcurrentHashSet(java.util.Collection<? extends E> c)
Constructs a new set containing the elements in the specified collection. |
|
ConcurrentHashSet(int initialCapacity)
Constructs a new, empty set; the backing ConcurrentHashMap has
specified initial capacity, default load factor, and default concurrencyLevel. |
|
ConcurrentHashSet(int initialCapacity,
float loadFactor)
|
Method Summary | |
---|---|
boolean |
add(E e)
Adds the specified element to this set if it is not already present. |
boolean |
addAll(java.util.Collection<? extends E> c)
|
void |
clear()
Removes all of the elements from this set. |
boolean |
contains(java.lang.Object o)
Returns true if this set contains the specified element. |
boolean |
isEmpty()
Returns true if this set contains no elements. |
java.util.Iterator<E> |
iterator()
Returns an iterator over the elements in this set. |
boolean |
remove(java.lang.Object o)
Removes the specified element from this set if it is present. |
int |
size()
Returns the number of elements in this set (its cardinality). |
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public ConcurrentHashSet()
ConcurrentHashMap
has default initial capacity, load factor, and concurrencyLevel.
public ConcurrentHashSet(java.util.Collection<? extends E> c)
c
- collection of elementspublic 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.
java.lang.IllegalArgumentException
- - if the initial capacity is negative or the load factor or concurrencyLevel are nonpositive.public ConcurrentHashSet(int initialCapacity)
ConcurrentHashMap
has
specified initial capacity, default load factor, and default concurrencyLevel.
initialCapacity
- initial capacity
java.lang.IllegalArgumentException
- - if the initial capacity of elements is negative.Method Detail |
---|
public boolean addAll(java.util.Collection<? extends E> c)
addAll
in interface java.util.Collection<E>
addAll
in interface java.util.Set<E>
addAll
in class java.util.AbstractCollection<E>
public java.util.Iterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
iterator
in interface java.util.Collection<E>
iterator
in interface java.util.Set<E>
iterator
in class java.util.AbstractCollection<E>
public int size()
size
in interface java.util.Collection<E>
size
in interface java.util.Set<E>
size
in class java.util.AbstractCollection<E>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<E>
isEmpty
in interface java.util.Set<E>
isEmpty
in class java.util.AbstractCollection<E>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<E>
contains
in interface java.util.Set<E>
contains
in class java.util.AbstractCollection<E>
o
- element whose presence in this set is to be tested
public boolean add(E e)
add
in interface java.util.Collection<E>
add
in interface java.util.Set<E>
add
in class java.util.AbstractCollection<E>
e
- element to be added to this set
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<E>
remove
in interface java.util.Set<E>
remove
in class java.util.AbstractCollection<E>
o
- object to be removed from this set, if present
public void clear()
clear
in interface java.util.Collection<E>
clear
in interface java.util.Set<E>
clear
in class java.util.AbstractCollection<E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |