Contents
Class Int3OpenHashSet
java.lang.Object
com.hypixel.hytale.math.data.Int3OpenHashSet
Open-addressed hash set keyed by three
int coordinates (x, y, z).
Keys are stored in a single stride-based int[] array ([x0, y0, z0, x1, y1, z1, ...])
to minimize field lookups and keep each entry's coordinates on the same cache line.
Occupancy is tracked in a parallel boolean[] since the set has no values to use
as an empty marker. Uses linear probing with backward-shift deletion (no tombstones).
Hashing uses Fibonacci hashing (Knuth 1973 — multiply by the golden-ratio constant, take top bits). The three coordinates are mixed via a MurmurHash3 64-bit finalizer (fmix64) before the Fibonacci index step.
Not thread-safe.
-
Constructor Summary
ConstructorsConstructorDescriptionInt3OpenHashSet(int expectedSize) Int3OpenHashSet(int expectedSize, float loadFactor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(int x, int y, int z) Adds the key (x, y, z).voidclear()booleancontains(int x, int y, int z) voidforEach(TriIntConsumer consumer) booleanisEmpty()booleanremove(int x, int y, int z) Removes the key (x, y, z).<T,V> void removeIf(Int3TriIntBiObjPredicate<T, V> predicate, int a, int b, int c, T obj1, V obj2) Zero-allocation variant ofremoveIf(TriIntPredicate)that forwards three captured int values and two captured objects to the predicate, avoiding the capture lambda allocation on the hot path.voidremoveIf(TriIntPredicate predicate) Removes every key matchingpredicate.intsize()
-
Constructor Details
-
Int3OpenHashSet
public Int3OpenHashSet() -
Int3OpenHashSet
public Int3OpenHashSet(int expectedSize) -
Int3OpenHashSet
public Int3OpenHashSet(int expectedSize, float loadFactor)
-
-
Method Details
-
add
public boolean add(int x, int y, int z) Adds the key (x, y, z). Returnstrueif the key was not already present. -
remove
public boolean remove(int x, int y, int z) Removes the key (x, y, z). Returnstrueif the key was present. -
contains
public boolean contains(int x, int y, int z) -
size
public int size() -
isEmpty
public boolean isEmpty() -
clear
public void clear() -
forEach
-
removeIf
Removes every key matchingpredicate. Equivalent to iterating withforEach(TriIntConsumer)and callingremove(int, int, int)for matches, but performs the removal in place without re-probing and without a post-pass shrink check per element. -
removeIf
public <T,V> void removeIf(@Nonnull Int3TriIntBiObjPredicate<T, V> predicate, int a, int b, int c, T obj1, V obj2) Zero-allocation variant ofremoveIf(TriIntPredicate)that forwards three captured int values and two captured objects to the predicate, avoiding the capture lambda allocation on the hot path.
-