public class MemoryKeyValueStore<K extends util.object.Identifiable,V> extends java.lang.Object implements KeyValueStore<K,V>
KeyValueStore
backed by an in-memory map; mainly useful for
testing.Constructor and Description |
---|
MemoryKeyValueStore()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
modify(K key,
java.util.function.Function<V,V> operation)
Updates the value associated to the specified key.
|
void |
put(K key,
V value)
Maps a key to a value.
|
void |
remove(K key)
Deletes the mapping identified by the specified key.
|
java.util.Map<K,V> |
store() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get
public void put(K key, V value)
KeyValueStore
put
in interface KeyValueStore<K extends util.object.Identifiable,V>
key
- identifies the mapping.value
- the value to store.public void modify(K key, java.util.function.Function<V,V> operation)
KeyValueStore
modify
in interface KeyValueStore<K extends util.object.Identifiable,V>
key
- identifies the mapping.operation
- is given the current value, does something with it and
then returns the new value.public void remove(K key)
KeyValueStore
remove
in interface KeyValueStore<K extends util.object.Identifiable,V>
key
- identifies the mapping.