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:
java.io.Serializable,java.lang.Iterable<E>,java.util.Collection<E>,java.util.Set<E>
public class NonBlockingHashSet<E> extends java.util.AbstractSet<E> implements java.io.SerializableA simple wrapper aroundNonBlockingHashMapmaking it implement theSetinterface. All operations are Non-Blocking and multi-thread safe.- Since:
- 1.5
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private NonBlockingHashMap<E,java.lang.Object>_mapprivate static java.lang.ObjectV
-
Constructor Summary
Constructors Constructor Description NonBlockingHashSet()Make a new emptyNonBlockingHashSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E o)Addoto the set.voidclear()Empty the set.booleancontains(java.lang.Object o)Eget(E o)java.util.Iterator<E>iterator()booleanremove(java.lang.Object o)Removeofrom the set.intsize()Current count of elements in the set.-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
V
private static final java.lang.Object V
-
_map
private final NonBlockingHashMap<E,java.lang.Object> _map
-
-
Constructor Detail
-
NonBlockingHashSet
public NonBlockingHashSet()
Make a new emptyNonBlockingHashSet.
-
-
Method Detail
-
add
public boolean add(E o)
Addoto the set.
-
contains
public boolean contains(java.lang.Object o)
-
remove
public boolean remove(java.lang.Object o)
Removeofrom 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.
-
clear
public void clear()
Empty the set.
-
-