Package org.jctools.maps
Class NonBlockingHashSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.jctools.maps.NonBlockingHashSet<E>
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Set<E>
A simple wrapper around
NonBlockingHashMap making it implement the
Set interface. All operations are Non-Blocking and multi-thread safe.- Since:
- 1.5
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
addAll, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
-
Field Details
-
V
-
_map
-
-
Constructor Details
-
NonBlockingHashSet
public NonBlockingHashSet()Make a new emptyNonBlockingHashSet.
-
-
Method Details
-
add
Addoto the set.- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classAbstractCollection<E>- Returns:
- true if
owas added to the set, false ifowas already in the set.
-
contains
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classAbstractCollection<E>- Returns:
- true if
ois in the set.
-
get
- Returns:
- Returns the match for
oifois in the set.
-
remove
Removeofrom the set.- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classAbstractCollection<E>- Returns:
- true if
owas removed to the set, false ifowas not in the set.
-
size
public int size()Current count of elements in the set. Due to concurrent racing updates, the size is only ever approximate. Updates due to the calling thread are immediately visible to calling thread.- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>- Returns:
- count of elements.
-
clear
public void clear()Empty the set.- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceSet<E>- Overrides:
clearin classAbstractCollection<E>
-
iterator
-