Class ArrayWrappedIntIntMap


public class ArrayWrappedIntIntMap extends Object
Simple Map type data structure for storing entries of (int -> int) mappings where the max key value is below 2^16 to avoid hashing keys and use direct array index reference for retrieving the values. Not thread-safe. Keys and values are expected to be >=0.
  • Constructor Details

    • ArrayWrappedIntIntMap

      public ArrayWrappedIntIntMap()
  • Method Details

    • put

      public void put(int key, int value)
    • get

      public int get(int key)
      Returns the value pointed by the given index. If the value is not set through put() it either returns Integer.MIN_VALUE or throws ArrayIndexOutOfBounds exception. Error checking is not done for faster retrieval.