Package org.apache.ignite.internal.util
Class GridConcurrentHashSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.apache.ignite.internal.util.GridSerializableSet<E>
-
- org.apache.ignite.internal.util.GridSetWrapper<E>
-
- org.apache.ignite.internal.util.GridConcurrentHashSet<E>
-
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Set<E>
public class GridConcurrentHashSet<E> extends GridSetWrapper<E>
Concurrent set implementation.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.util.GridSetWrapper
map, VAL
-
-
Constructor Summary
Constructors Constructor Description GridConcurrentHashSet()Creates a new, empty set with a default initial capacity, load factor, and concurrencyLevel.GridConcurrentHashSet(int initCap)Creates a new, empty set with the specified initial capacity, and with default load factor and concurrencyLevel.GridConcurrentHashSet(int initCap, float loadFactor, int conLevel)Creates a new, empty set with the specified initial capacity, load factor, and concurrency level.GridConcurrentHashSet(Collection<E> c)Creates a new set with the same elements as the given collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E e)Note that unlike regular add operation on a set, this method will only add the passed in element if it's not already present in set.Eaddx(E e)Note that unlike regular add operation on a set, this method will only add the passed in element if it's not already present in set.StringtoString()-
Methods inherited from class org.apache.ignite.internal.util.GridSetWrapper
clear, contains, defaultValue, isEmpty, iterator, map, remove, size, toArray, toArray
-
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
addAll, containsAll, retainAll, spliterator
-
-
-
-
Constructor Detail
-
GridConcurrentHashSet
public GridConcurrentHashSet()
Creates a new, empty set with a default initial capacity, load factor, and concurrencyLevel.
-
GridConcurrentHashSet
public GridConcurrentHashSet(int initCap)
Creates a new, empty set with the specified initial capacity, and with default load factor and concurrencyLevel.- Parameters:
initCap- The initial capacity. The implementation performs internal sizing to accommodate this many elements.- Throws:
IllegalArgumentException- if the initial capacity of elements is negative.
-
GridConcurrentHashSet
public GridConcurrentHashSet(int initCap, float loadFactor, int conLevel)Creates a new, empty set with the specified initial capacity, load factor, and concurrency level.- Parameters:
initCap- 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.conLevel- The estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads.- Throws:
IllegalArgumentException- if the initial capacity is negative or the load factor or concurrency level are non-positive.
-
GridConcurrentHashSet
public GridConcurrentHashSet(Collection<E> c)
Creates a new set with the same elements as the given collection. The collection is created with a capacity of twice the number of mappings in the given map or 11 (whichever is greater), and a default load factor and concurrencyLevel.- Parameters:
c- Collection to add.
-
-
Method Detail
-
add
public boolean add(E e)
Note that unlike regular add operation on a set, this method will only add the passed in element if it's not already present in set.- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classGridSetWrapper<E>- Parameters:
e- Element to add.- Returns:
Trueif element was added.
-
addx
@Nullable public E addx(E e)
Note that unlike regular add operation on a set, this method will only add the passed in element if it's not already present in set.- Parameters:
e- Element to add.- Returns:
- Value previously present in set or
nullif set didn't have this value.
-
toString
public String toString()
- Overrides:
toStringin classGridSetWrapper<E>
-
-