Package org.h2.dev.cluster
Class ShardedMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- org.h2.dev.cluster.ShardedMap<K,V>
-
- Type Parameters:
K- the key typeV- the value type
- All Implemented Interfaces:
java.util.Map<K,V>
public class ShardedMap<K,V> extends java.util.AbstractMap<K,V>A sharded map. It is typically split into multiple sub-maps that don't have overlapping keys.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceShardedMap.CountedMap<K,V>A map that can efficiently return the index of a key, and the key at a given index.static interfaceShardedMap.LargeMapA large map.
-
Constructor Summary
Constructors Constructor Description ShardedMap()ShardedMap(DataType keyType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMap(java.util.Map<K,V> map, K min, K max)Add the given shard.java.util.Set<java.util.Map.Entry<K,V>>entrySet()Vget(java.lang.Object key)Vput(K key, V value)intsize()longsizeAsLong()The size of the map.-
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, toString, values
-
-
-
-
Constructor Detail
-
ShardedMap
public ShardedMap()
-
ShardedMap
public ShardedMap(DataType keyType)
-
-
Method Detail
-
addMap
public void addMap(java.util.Map<K,V> map, K min, K max)
Add the given shard.- Parameters:
map- the mapmin- the lowest key, or null if no limitmax- the highest key, or null if no limit
-
size
public int size()
-
sizeAsLong
public long sizeAsLong()
The size of the map.- Returns:
- the size
-
get
public V get(java.lang.Object key)
-
-