Class IntMap


public final class IntMap extends IntSet
This is an efficient and memory-saving hash map for storing primitive integers. It extends the IntSet class. All values except for Integer.MIN_VALUE can be stored as values.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • IntMap

      public IntMap()
      Default constructor.
    • IntMap

      public IntMap(long capacity)
      Constructor with initial capacity.
      Parameters:
      capacity - array capacity (will be resized to a power of two)
  • Method Details

    • put

      public int put(int key, int value)
      Indexes the specified key and stores the associated value. If the key already exists, the value is updated. Please note that the value Integer.MIN_VALUE cannot be stored.
      Parameters:
      key - key
      value - value
      Returns:
      old value
    • get

      public int get(int key)
      Returns the value for the specified key.
      Parameters:
      key - key to be looked up
      Returns:
      value or Integer.MIN_VALUE if the key was not found
    • rehash

      protected void rehash(int newSize)
      Description copied from class: ASet
      Rehashes all entries.
      Overrides:
      rehash in class IntSet
      Parameters:
      newSize - new hash size
    • toString

      public String toString()
      Overrides:
      toString in class IntSet