Class ShardedMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
org.h2.dev.cluster.ShardedMap<K,V>
Type Parameters:
K - the key type
V - the value type
All Implemented Interfaces:
Map<K,V>

public class ShardedMap<K,V> extends AbstractMap<K,V>
A sharded map. It is typically split into multiple sub-maps that don't have overlapping keys.
  • Constructor Details

    • ShardedMap

      public ShardedMap()
    • ShardedMap

      public ShardedMap(DataType keyType)
  • Method Details

    • addMap

      public void addMap(Map<K,V> map, K min, K max)
      Add the given shard.
      Parameters:
      map - the map
      min - the lowest key, or null if no limit
      max - the highest key, or null if no limit
    • size

      public int size()
      Specified by:
      size in interface Map<K,V>
      Overrides:
      size in class 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 Map<K,V>
      Overrides:
      put in class AbstractMap<K,V>
    • get

      public V get(Object key)
      Specified by:
      get in interface Map<K,V>
      Overrides:
      get in class AbstractMap<K,V>
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
      Specified by:
      entrySet in interface Map<K,V>
      Specified by:
      entrySet in class AbstractMap<K,V>