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.Serializable
A simple wrapper aroundNonBlockingHashMap
making it implement theSet
interface. 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>
_map
private static java.lang.Object
V
-
Constructor Summary
Constructors Constructor Description NonBlockingHashSet()
Make a new emptyNonBlockingHashSet
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E o)
Addo
to the set.void
clear()
Empty the set.boolean
contains(java.lang.Object o)
E
get(E o)
java.util.Iterator<E>
iterator()
boolean
remove(java.lang.Object o)
Removeo
from the set.int
size()
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)
Addo
to the set.
-
contains
public boolean contains(java.lang.Object o)
-
remove
public boolean remove(java.lang.Object o)
Removeo
from 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.
-
-