public interface KeyValueStore<K extends util.object.Identifiable,V>
V
to an
Identifiable
key.Modifier and Type | Method and Description |
---|---|
default V |
get(K key)
Gets the value associated to the specified key.
|
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.
|
void put(K key, V value)
key
- identifies the mapping.value
- the value to store.java.lang.NullPointerException
- if any argument is null
.
The following checked exceptions are rethrown as unchecked (i.e.
the exception is masked as a runtime exception and thrown as is without
wrapping it in a RuntimeException
):
IOException
if an I/O occurs.
default V get(K key)
key
- identifies the mapping.java.lang.NullPointerException
- if the argument is null
.java.lang.IllegalArgumentException
- if no value is associated to the given
key.
The following checked exceptions are rethrown as unchecked (i.e.
the exception is masked as a runtime exception and thrown as is without
wrapping it in a RuntimeException
):
IOException
if an I/O occurs.
void modify(K key, java.util.function.Function<V,V> operation)
key
- identifies the mapping.operation
- is given the current value, does something with it and
then returns the new value.java.lang.NullPointerException
- if any argument is null
.java.lang.IllegalArgumentException
- if no value is associated to the given
key.
The following checked exceptions are rethrown as unchecked (i.e.
the exception is masked as a runtime exception and thrown as is without
wrapping it in a RuntimeException
):
IOException
if an I/O occurs.
void remove(K key)
key
- identifies the mapping.java.lang.NullPointerException
- if the argument is null
.
The following checked exceptions are rethrown as unchecked (i.e.
the exception is masked as a runtime exception and thrown as is without
wrapping it in a RuntimeException
):
IOException
if an I/O occurs.