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:
java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.Set<E>
public class SingleWriterHashSet<E> extends java.util.AbstractSet<E>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SingleWriterHashSet.Iter<E>
-
Field Summary
Fields Modifier and Type Field Description private E[]
buffer
private static long
BUFFER_OFFSET
private static long
MC_OFFSET
private long
modCount
private int
resizeThreshold
private int
size
private static long
SIZE_OFFSET
-
Constructor Summary
Constructors Constructor Description SingleWriterHashSet(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E newVal)
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
contains(java.lang.Object needle)
private boolean
containsImpl(java.lang.Object needle)
private boolean
containsSlowPath(E[] buffer, long mask, int hash, java.lang.Object needle)
java.util.Iterator<E>
iterator()
private E[]
lvBuffer()
private int
rehash(int h)
boolean
remove(java.lang.Object val)
private boolean
removeSlowPath(java.lang.Object val, E[] buffer, long mask, int hash)
private void
resize()
int
size()
private void
soBuffer(E[] buffer)
java.lang.String
toString()
-
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray
-
-
-
-
Field Detail
-
size
private int size
-
modCount
private long modCount
-
buffer
private E[] 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
-
-
Method Detail
-
size
public int size()
-
add
public boolean add(E newVal)
-
resize
private void resize()
-
remove
public boolean remove(java.lang.Object val)
-
removeSlowPath
private boolean removeSlowPath(java.lang.Object val, E[] buffer, long mask, int hash)
-
compactAndRemove
private void compactAndRemove(E[] buffer, long mask, int removeHashIndex)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.AbstractCollection<E>
-
rehash
private int rehash(int h)
-
contains
public boolean contains(java.lang.Object needle)
-
containsImpl
private boolean containsImpl(java.lang.Object needle)
-
containsSlowPath
private boolean containsSlowPath(E[] buffer, long mask, int hash, java.lang.Object needle)
-
iterator
public java.util.Iterator<E> iterator()
-
soBuffer
private void soBuffer(E[] buffer)
-
lvBuffer
private E[] lvBuffer()
-
-