Class ConcurrentHashSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.apache.wicket.util.collections.ConcurrentHashSet<E>
-
- Type Parameters:
E-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<E>,java.util.Collection<E>,java.util.Set<E>
public class ConcurrentHashSet<E> extends java.util.AbstractSet<E> implements java.util.Set<E>, java.lang.Cloneable, java.io.SerializableThis class implements the Set interface, backed by a ConcurrentHashMap instance.- Author:
- Matt Tucker
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConcurrentHashSet()Constructs a new, empty set; the backing ConcurrentHashMap instance has default initial capacity (16) and load factor (0.75).ConcurrentHashSet(int initialCapacity)Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and default load factor, which is 0.75.ConcurrentHashSet(int initialCapacity, float loadFactor)Constructs a new, empty set; the backing ConcurrentHashMap instance has the specified initial capacity and the specified load factor.ConcurrentHashSet(java.util.Collection<? extends E> c)Constructs a new set containing the elements in the specified collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E o)voidclear()java.lang.Objectclone()booleancontains(java.lang.Object o)booleanisEmpty()java.util.Iterator<E>iterator()booleanremove(java.lang.Object o)intsize()-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
ConcurrentHashSet
public ConcurrentHashSet()
Constructs a new, empty set; the backing ConcurrentHashMap instance has default initial capacity (16) and load factor (0.75).
-
ConcurrentHashSet
public ConcurrentHashSet(java.util.Collection<? extends E> c)
Constructs a new set containing the elements in the specified collection. The ConcurrentHashMap is created with default load factor (0.75) and an initial capacity sufficient to contain the elements in the specified collection.- Parameters:
c- the collection whose elements are to be placed into this set.- Throws:
java.lang.NullPointerException- if the specified collection is null.
-
ConcurrentHashSet
public ConcurrentHashSet(int initialCapacity, float loadFactor)Constructs a new, empty set; the backing ConcurrentHashMap instance has the specified initial capacity and the specified load factor.- Parameters:
initialCapacity- the initial capacity of the hash map.loadFactor- the load factor of the hash map.- Throws:
java.lang.IllegalArgumentException- if the initial capacity is less than zero, or if the load factor is nonpositive.
-
ConcurrentHashSet
public ConcurrentHashSet(int initialCapacity)
Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and default load factor, which is 0.75.- Parameters:
initialCapacity- the initial capacity of the hash table.- Throws:
java.lang.IllegalArgumentException- if the initial capacity is less than zero.
-
-
Method Detail
-
iterator
public java.util.Iterator<E> iterator()
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(java.lang.Object o)
-
add
public boolean add(E o)
-
remove
public boolean remove(java.lang.Object o)
-
clear
public void clear()
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
-