Class ShortScatterSet
java.lang.Object
com.carrotsearch.hppc.AbstractShortCollection
com.carrotsearch.hppc.ShortHashSet
com.carrotsearch.hppc.ShortScatterSet
- All Implemented Interfaces:
Preallocable, ShortCollection, ShortContainer, ShortLookupContainer, ShortSet, Cloneable, Iterable<ShortCursor>
@Generated(date="2024-05-16T08:18:11+0000",
value="KTypeScatterSet.java")
public class ShortScatterSet
extends ShortHashSet
Same as
ShortHashSet but does not implement per-instance key mixing
strategy and uses a simpler (faster) bit distribution function.
Note: read about important differences between hash and scatter sets.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ShortHashSet
ShortHashSet.EntryIterator -
Field Summary
Fields inherited from class ShortHashSet
assigned, hasEmptyKey, keyMixer, keys, loadFactor, mask, orderMixer, resizeAt -
Constructor Summary
ConstructorsConstructorDescriptionNew instance with sane defaults.ShortScatterSet(int expectedElements) New instance with sane defaults.ShortScatterSet(int expectedElements, double loadFactor) New instance with sane defaults. -
Method Summary
Modifier and TypeMethodDescriptionstatic ShortScatterSetfrom(short... elements) Create a set from a variable number of arguments or an array ofshort.protected inthashKey(short key) Returns a hash code for the given key.Methods inherited from class ShortHashSet
add, addAll, addAll, addAll, allocateBuffers, allocateThenInsertThenRehash, clear, clone, contains, ensureCapacity, equals, forEach, forEach, hashCode, indexExists, indexGet, indexInsert, indexOf, indexReplace, isEmpty, iterator, rehash, release, remove, removeAll, removeAll, shiftConflictingKeys, size, toArray, verifyLoadFactor, visualizeKeyDistributionMethods inherited from class AbstractShortCollection
removeAll, retainAll, retainAll, toStringMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface ShortCollection
removeAll, retainAll, retainAll
-
Constructor Details
-
ShortScatterSet
public ShortScatterSet()New instance with sane defaults. -
ShortScatterSet
public ShortScatterSet(int expectedElements) New instance with sane defaults. -
ShortScatterSet
public ShortScatterSet(int expectedElements, double loadFactor) New instance with sane defaults.
-
-
Method Details
-
hashKey
protected int hashKey(short key) Description copied from class:ShortHashSetReturns a hash code for the given key. The default implementation mixes the hash of the key withShortHashSet.keyMixerto differentiate hash order of keys between hash containers. Helps alleviate problems resulting from linear conflict resolution in open addressing. The output from this function should evenly distribute keys across the entire integer range.- Overrides:
hashKeyin classShortHashSet
-
from
Create a set from a variable number of arguments or an array ofshort. The elements are copied from the argument to the internal buffer.
-