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 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.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`ShardedMap.CountedMap<K,V>`
A map that can efficiently return the index of a key, and the key at a given index.
`static interface`
`ShardedMap.LargeMap`
A large map.

## Nested classes/interfaces inherited from class java.util.AbstractMap

`AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>`

## Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K extends Object,V extends Object>`

## Constructor Summary

Constructors
Constructor
Description
`ShardedMap()`
`ShardedMap(DataType keyType)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addMap(Map<K,V> map, K min, K max)`
Add the given shard.
`Set<Map.Entry<K,V>>`
`entrySet()`
`V`
`get(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

`compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll`

## 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>`