Package org.jboss.util.collection
Class ConcurrentReferenceHashSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.jboss.util.collection.MapDelegateSet<E>
-
- org.jboss.util.collection.ConcurrentReferenceHashSet<E>
-
- Type Parameters:
E
- the element type
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.Set<E>
public class ConcurrentReferenceHashSet<E> extends MapDelegateSet<E>
Set based on top of ConcurrentReferenceHashMap. It's serializable if the elements are serializable.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
The serialVersionUID
-
Constructor Summary
Constructors Constructor Description ConcurrentReferenceHashSet()
Creates a new, empty set with a default initial capacity (16), reference types (weak keys, strong values), default load factor (0.75) and concurrencyLevel (16).ConcurrentReferenceHashSet(int initialCapacity)
Creates a new, empty set with the specified initial capacity, and with default reference types (weak keys, strong values), load factor (0.75) and concurrencyLevel (16).ConcurrentReferenceHashSet(int initialCapacity, float loadFactor)
Creates a new, empty set with the specified initial capacity and load factor and with the default reference types (weak keys, strong values), and concurrencyLevel (16).ConcurrentReferenceHashSet(int initialCapacity, float loadFactor, int concurrencyLevel)
Creates a new, empty set with the specified initial capacity, load factor and concurrency level.ConcurrentReferenceHashSet(int initialCapacity, ConcurrentReferenceHashMap.ReferenceType type)
Creates a new, empty set with the specified initial capacity, reference type and with default load factor (0.75) and concurrencyLevel (16).ConcurrentReferenceHashSet(java.util.Set<? extends E> s)
Creates a new set with the same contents as the given set.ConcurrentReferenceHashSet(ConcurrentReferenceHashMap.ReferenceType type)
Creates a new, empty reference set with the specified key and value reference types.ConcurrentReferenceHashSet(ConcurrentReferenceHashMap.ReferenceType type, java.util.EnumSet<ConcurrentReferenceHashMap.Option> options)
Creates a new, empty reference set with the specified reference types and behavioral options.
-
Method Summary
-
Methods inherited from class org.jboss.util.collection.MapDelegateSet
add, clear, contains, isEmpty, iterator, remove, size, toString
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
The serialVersionUID- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ConcurrentReferenceHashSet
public ConcurrentReferenceHashSet(int initialCapacity, float loadFactor, int concurrencyLevel)
Creates a new, empty set with the specified initial capacity, load factor and concurrency level.- Parameters:
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.- Throws:
java.lang.IllegalArgumentException
- if the initial capacity is negative or the load factor or concurrencyLevel are nonpositive.
-
ConcurrentReferenceHashSet
public ConcurrentReferenceHashSet(int initialCapacity, float loadFactor)
Creates a new, empty set with the specified initial capacity and load factor and with the default reference types (weak keys, strong values), and concurrencyLevel (16).- Parameters:
initialCapacity
- 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.- Throws:
java.lang.IllegalArgumentException
- if the initial capacity of elements is negative or the load factor is nonpositive- Since:
- 1.6
-
ConcurrentReferenceHashSet
public ConcurrentReferenceHashSet(int initialCapacity, ConcurrentReferenceHashMap.ReferenceType type)
Creates a new, empty set with the specified initial capacity, reference type and with default load factor (0.75) and concurrencyLevel (16).- Parameters:
initialCapacity
- the initial capacity. The implementation performs internal sizing to accommodate this many elements.type
- the reference type to use- Throws:
java.lang.IllegalArgumentException
- if the initial capacity of elements is negative.
-
ConcurrentReferenceHashSet
public ConcurrentReferenceHashSet(ConcurrentReferenceHashMap.ReferenceType type)
Creates a new, empty reference set with the specified key and value reference types.- Parameters:
type
- the reference type to use- Throws:
java.lang.IllegalArgumentException
- if the initial capacity of elements is negative.
-
ConcurrentReferenceHashSet
public ConcurrentReferenceHashSet(ConcurrentReferenceHashMap.ReferenceType type, java.util.EnumSet<ConcurrentReferenceHashMap.Option> options)
Creates a new, empty reference set with the specified reference types and behavioral options.- Parameters:
type
- the reference type to useoptions
- the options- Throws:
java.lang.IllegalArgumentException
- if the initial capacity of elements is negative.
-
ConcurrentReferenceHashSet
public ConcurrentReferenceHashSet(int initialCapacity)
Creates a new, empty set with the specified initial capacity, and with default reference types (weak keys, strong values), load factor (0.75) and concurrencyLevel (16).- Parameters:
initialCapacity
- the initial capacity. The implementation performs internal sizing to accommodate this many elements.- Throws:
java.lang.IllegalArgumentException
- if the initial capacity of elements is negative.
-
ConcurrentReferenceHashSet
public ConcurrentReferenceHashSet()
Creates a new, empty set with a default initial capacity (16), reference types (weak keys, strong values), default load factor (0.75) and concurrencyLevel (16).
-
ConcurrentReferenceHashSet
public ConcurrentReferenceHashSet(java.util.Set<? extends E> s)
Creates a new set with the same contents as the given set.- Parameters:
s
- the set
-
-