Class SingleWriterHashSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.jctools.sets.SingleWriterHashSet<E>
- All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate E[]private static final longprivate static final longprivate longprivate intprivate intprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprivate voidaddForResize(E[] buffer, long mask, E newVal) private booleanaddSlowPath(E[] buffer, long mask, E newVal, int hash) private voidcompactAndRemove(E[] buffer, long mask, int removeHashIndex) booleanprivate booleancontainsImpl(Object needle) private booleancontainsSlowPath(E[] buffer, long mask, int hash, Object needle) iterator()private E[]lvBuffer()private intrehash(int h) booleanprivate booleanremoveSlowPath(Object val, E[] buffer, long mask, int hash) private voidresize()intsize()private voidtoString()Methods inherited from class AbstractSet
equals, hashCode, removeAllMethods inherited from class AbstractCollection
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArrayMethods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface Set
addAll, clear, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
-
Field Details
-
size
private int size -
modCount
private long modCount -
buffer
-
resizeThreshold
private int resizeThreshold -
BUFFER_OFFSET
private static final long BUFFER_OFFSET -
SIZE_OFFSET
private static final long SIZE_OFFSET -
MC_OFFSET
private static final long MC_OFFSET
-
-
Constructor Details
-
SingleWriterHashSet
public SingleWriterHashSet(int capacity)
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
add
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classAbstractCollection<E>
-
addForResize
-
addSlowPath
-
resize
private void resize() -
remove
- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classAbstractCollection<E>
-
removeSlowPath
-
compactAndRemove
-
toString
- Overrides:
toStringin classAbstractCollection<E>
-
rehash
private int rehash(int h) -
contains
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classAbstractCollection<E>
-
containsImpl
-
containsSlowPath
-
iterator
-
soBuffer
-
lvBuffer
-