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>
- implements java.util.Map<K,V>
A sharded map. It is typically split into multiple sub-maps that don't have
overlapping keys.
| Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
|
Method Summary |
void |
addMap(java.util.Map<K,V> map,
K min,
K max)
Add the given shard. |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
V |
get(java.lang.Object key)
|
V |
put(K key,
V value)
|
int |
size()
|
long |
sizeAsLong()
The size of the map. |
| Methods inherited from class java.util.AbstractMap |
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, toString, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, values |
ShardedMap
public ShardedMap()
ShardedMap
public ShardedMap(DataType keyType)
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()
- Specified by:
size in interface java.util.Map<K,V>- Overrides:
size in class java.util.AbstractMap<K,V>
sizeAsLong
public long sizeAsLong()
- The size of the map.
- Returns:
- the size
put
public V put(K key,
V value)
- Specified by:
put in interface java.util.Map<K,V>- Overrides:
put in class java.util.AbstractMap<K,V>
get
public V get(java.lang.Object key)
- Specified by:
get in interface java.util.Map<K,V>- Overrides:
get in class java.util.AbstractMap<K,V>
entrySet
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
- Specified by:
entrySet in interface java.util.Map<K,V>- Specified by:
entrySet in class java.util.AbstractMap<K,V>