org.h2.dev.cluster
Interface ShardedMap.CountedMap<K,V>

Enclosing class:
ShardedMap<K,V>

public static interface ShardedMap.CountedMap<K,V>

A map that can efficiently return the index of a key, and the key at a given index.


Method Summary
 K getKey(long index)
          Get the key at the given index.
 long getKeyIndex(K key)
          Get the index of the given key in the map.
 

Method Detail

getKey

K getKey(long index)
Get the key at the given index.

Parameters:
index - the index
Returns:
the key

getKeyIndex

long getKeyIndex(K key)
Get the index of the given key in the map.

If the key was found, the returned value is the index in the key array. If not found, the returned value is negative, where -1 means the provided key is smaller than any keys. See also Arrays.binarySearch.

Parameters:
key - the key
Returns:
the index