Class Int3ObjectOpenHashMap<V>

java.lang.Object
com.hypixel.hytale.math.data.Int3ObjectOpenHashMap<V>
Type Parameters:
V - value type (must not be null)

public class Int3ObjectOpenHashMap<V> extends Object
Open-addressed hash map 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. Uses linear probing with backward-shift deletion (no tombstones). Null values are disallowed; a null in the values array indicates an empty slot.

Hashing uses Fibonacci hashing (Knuth 1973 — multiply by the golden-ratio constant, take top bits) which provides near-uniform slot distribution for sequential and clustered keys. The three coordinates are mixed via a MurmurHash3 64-bit finalizer (fmix64) before the Fibonacci index step.

Not thread-safe.

  • Constructor Details

    • Int3ObjectOpenHashMap

      public Int3ObjectOpenHashMap()
    • Int3ObjectOpenHashMap

      public Int3ObjectOpenHashMap(int expectedSize)
    • Int3ObjectOpenHashMap

      public Int3ObjectOpenHashMap(int expectedSize, float loadFactor)
    • Int3ObjectOpenHashMap

      public Int3ObjectOpenHashMap(@Nonnull Int3ObjectOpenHashMap<? extends V> other)
  • Method Details

    • get

      @Nullable public V get(int x, int y, int z)
    • put

      @Nullable public V put(int x, int y, int z, @Nonnull V value)
    • remove

      @Nullable public V remove(int x, int y, int z)
    • containsKey

      public boolean containsKey(int x, int y, int z)
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • clear

      public void clear()
    • forEach

      public void forEach(@Nonnull TriIntObjectConsumer<? super V> consumer)
    • allMatch

      public boolean allMatch(@Nonnull TriIntObjPredicate<? super V> predicate)
      Whether every entry passes the predicate. Stops at the first entry that does not.
    • trim

      public void trim()
      Shrinks the table to the smallest capacity that holds the entries.