Package org.basex.util.hash
Class IntMap
java.lang.Object
org.basex.util.hash.ASet
org.basex.util.hash.IntSet
org.basex.util.hash.IntMap
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 valueInteger.MIN_VALUEcannot be stored.- Parameters:
key- keyvalue- 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_VALUEif the key was not found
-
rehash
protected void rehash(int newSize) Description copied from class:ASetRehashes all entries. -
toString
-