Package org.jctools.sets
Class OpenHashSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.jctools.sets.OpenHashSet<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.Set<E>
public class OpenHashSet<E> extends java.util.AbstractSet<E>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
OpenHashSet.Iter<E>
-
Field Summary
Fields Modifier and Type Field Description private E[]
buffer
private int
resizeThreshold
private int
size
-
Constructor Summary
Constructors Constructor Description OpenHashSet(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E newVal)
private void
addForResize(E[] buffer, int mask, E newVal)
private boolean
addSlowPath(E[] buffer, int mask, E newVal, int hash)
private void
compactAndRemove(E[] buffer, int mask, int removeHashIndex)
boolean
contains(java.lang.Object needle)
private boolean
containsSlowPath(E[] buffer, int mask, int hash, java.lang.Object needle)
java.util.Iterator<E>
iterator()
private int
rehash(int h)
boolean
remove(java.lang.Object val)
private boolean
removeSlowPath(java.lang.Object val, E[] buffer, int mask, int hash)
private void
resize()
int
size()
-
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
size
private int size
-
buffer
private E[] buffer
-
resizeThreshold
private int resizeThreshold
-
-
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, int mask, int hash)
-
compactAndRemove
private void compactAndRemove(E[] buffer, int mask, int removeHashIndex)
-
rehash
private int rehash(int h)
-
contains
public boolean contains(java.lang.Object needle)
-
containsSlowPath
private boolean containsSlowPath(E[] buffer, int mask, int hash, java.lang.Object needle)
-
-