org.h2.util
Class ValueHashMap<V>

java.lang.Object
  extended by org.h2.util.HashBase
      extended by org.h2.util.ValueHashMap<V>
Type Parameters:
V - the value type

public class ValueHashMap<V>
extends HashBase

This hash map supports keys of type Value.


Field Summary
 
Fields inherited from class org.h2.util.HashBase
deletedCount, len, level, mask, size, zeroKey
 
Method Summary
 V get(Value key)
          Get the value for this key.
 ObjectArray<Value> keys()
          Get the list of keys.
static
<T> ValueHashMap<T>
newInstance(DataHandler handler)
          Create a new value hash map using the given data handler.
 void put(Value key, V value)
          Add or update a key value pair.
protected  void rehash(int newLevel)
          Increase the size of the underlying table and re-distribute the elements.
 void remove(Value key)
          Remove a key value pair.
protected  void reset(int newLevel)
          Clear the map and reset the level to the specified value.
 ObjectArray<V> values()
          Get the list of values.
 
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
 

Method Detail

newInstance

public static <T> ValueHashMap<T> newInstance(DataHandler handler)
Create a new value hash map using the given data handler. The data handler is used to compare values.

Parameters:
handler - the data handler
Returns:
the object

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

rehash

protected void rehash(int newLevel)
               throws java.sql.SQLException
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
Throws:
java.sql.SQLException

put

public void put(Value key,
                V value)
         throws java.sql.SQLException
Add or update a key value pair.

Parameters:
key - the key
value - the new value
Throws:
java.sql.SQLException

remove

public void remove(Value key)
            throws java.sql.SQLException
Remove a key value pair.

Parameters:
key - the key
Throws:
java.sql.SQLException

get

public V get(Value key)
      throws java.sql.SQLException
Get the value for this key. This method returns null if the key was not found.

Parameters:
key - the key
Returns:
the value for the given key
Throws:
java.sql.SQLException

keys

public ObjectArray<Value> keys()
Get the list of keys.

Returns:
all keys

values

public ObjectArray<V> values()
Get the list of values.

Returns:
all values