Package org.jctools.sets
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 long
private static final long
private long
private int
private int
private static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
private void
addForResize
(E[] buffer, long mask, E newVal) private boolean
addSlowPath
(E[] buffer, long mask, E newVal, int hash) private void
compactAndRemove
(E[] buffer, long mask, int removeHashIndex) boolean
private boolean
containsImpl
(Object needle) private boolean
containsSlowPath
(E[] buffer, long mask, int hash, Object needle) iterator()
private E[]
lvBuffer()
private int
rehash
(int h) boolean
private boolean
removeSlowPath
(Object val, E[] buffer, long mask, int hash) private void
resize()
int
size()
private void
toString()
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray
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, 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:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
-
add
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceSet<E>
- Overrides:
add
in classAbstractCollection<E>
-
addForResize
-
addSlowPath
-
resize
private void resize() -
remove
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceSet<E>
- Overrides:
remove
in classAbstractCollection<E>
-
removeSlowPath
-
compactAndRemove
-
toString
- Overrides:
toString
in classAbstractCollection<E>
-
rehash
private int rehash(int h) -
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Overrides:
contains
in classAbstractCollection<E>
-
containsImpl
-
containsSlowPath
-
iterator
-
soBuffer
-
lvBuffer
-