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:
Iterable<E>
,Collection<E>
,Set<E>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
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
private boolean
containsSlowPath
(E[] buffer, int mask, int hash, Object needle) iterator()
private int
rehash
(int h) boolean
private boolean
removeSlowPath
(Object val, E[] buffer, int mask, int hash) private void
resize()
int
size()
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString
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 -
buffer
-
resizeThreshold
private int resizeThreshold
-
-
Constructor Details
-
OpenHashSet
public OpenHashSet(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
-
rehash
private int rehash(int h) -
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Overrides:
contains
in classAbstractCollection<E>
-
containsSlowPath
-
iterator
-