Class Int3OpenHashSet

java.lang.Object
com.hypixel.hytale.math.data.Int3OpenHashSet

public class Int3OpenHashSet extends Object
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 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). Returns true if the key was not already present.
    • remove

      public boolean remove(int x, int y, int z)
      Removes the key (x, y, z). Returns true if 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

      public void forEach(@Nonnull TriIntConsumer consumer)
    • removeIf

      public void removeIf(@Nonnull TriIntPredicate predicate)
      Removes every key matching predicate. Equivalent to iterating with forEach(TriIntConsumer) and calling remove(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 of removeIf(TriIntPredicate) that forwards three captured int values and two captured objects to the predicate, avoiding the capture lambda allocation on the hot path.