org.h2.util
Class IntIntHashMap

java.lang.Object
  extended by org.h2.util.HashBase
      extended by org.h2.util.IntIntHashMap

public class IntIntHashMap
extends HashBase

A hash map with int key and int values. There is a restriction: the value -1 (NOT_FOUND) cannot be stored in the map. 0 can be stored. An empty record has key=0 and value=0. A deleted record has key=0 and value=DELETED


Field Summary
static int NOT_FOUND
          The value indicating that the entry has not been found.
 
Fields inherited from class org.h2.util.HashBase
deletedCount, len, level, mask, size, zeroKey
 
Constructor Summary
IntIntHashMap()
           
 
Method Summary
 int get(int key)
          Get the value for the given key.
 void put(int key, int value)
          Store the given key-value pair.
protected  void rehash(int newLevel)
          Increase the size of the underlying table and re-distribute the elements.
 void remove(int key)
          Remove the key-value pair with the given key.
protected  void reset(int newLevel)
          Clear the map and reset the level to the specified value.
 
Methods inherited from class org.h2.util.HashBase
checkSizeRemove, getIndex, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_FOUND

public static final int NOT_FOUND
The value indicating that the entry has not been found.

See Also:
Constant Field Values
Constructor Detail

IntIntHashMap

public IntIntHashMap()
Method Detail

reset

protected void reset(int newLevel)
Description copied from class: HashBase
Clear the map and reset the level to the specified value.

Overrides:
reset in class HashBase
Parameters:
newLevel - the new level

put

public void put(int key,
                int value)
Store the given key-value pair. The value is overwritten or added.

Parameters:
key - the key
value - the value (-1 is not supported)

remove

public void remove(int key)
Remove the key-value pair with the given key.

Parameters:
key - the key

rehash

protected void rehash(int newLevel)
Description copied from class: HashBase
Increase the size of the underlying table and re-distribute the elements.

Specified by:
rehash in class HashBase
Parameters:
newLevel - the new level

get

public int get(int key)
Get the value for the given key. This method returns NOT_FOUND if the entry has not been found.

Parameters:
key - the key
Returns:
the value or NOT_FOUND