K
- the type of keys in this mapV
- the type of values in this mappublic interface MapIndex<K,V>
The "destructive" methods of the map, i.e., the one that change the map contents,
are specified to throw UnsupportedOperationException
if
the map has been created with a read-only database view.
This interface prohibits null keys and values.
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all of the key-value pairs from the map.
|
boolean |
containsKey(K key)
Returns true if this map contains a mapping for the specified key.
|
java.util.Iterator<MapEntry<K,V>> |
entries()
Returns an iterator over the map entries.
|
V |
get(K key)
Returns the value associated with the specified key,
or
null if there is no mapping for the key. |
java.lang.String |
getName()
Returns the name of this index.
|
default boolean |
isEmpty()
Returns true if this map has no entries.
|
java.util.Iterator<K> |
keys()
Returns an iterator over the map keys in lexicographical order.
|
void |
put(K key,
V value)
Puts a new key-value pair into the map.
|
default void |
putAll(java.util.Map<? extends K,? extends V> sourceMap)
Puts all key-value pairs from the given map into this map.
|
void |
remove(K key)
Removes the value mapped to the specified key from the map.
|
java.util.Iterator<V> |
values()
Returns an iterator over the map values in lexicographical order of keys.
|
boolean containsKey(K key)
java.lang.IllegalStateException
- if this map is not validvoid put(K key, V value)
key
- a storage keyvalue
- a storage value to associate with the keyjava.lang.IllegalStateException
- if this map is not validjava.lang.IllegalArgumentException
- if some property of the key or the value prevents it
from being stored in this mapjava.lang.UnsupportedOperationException
- if this map is read-onlydefault void putAll(java.util.Map<? extends K,? extends V> sourceMap)
put(K, V)
operations.sourceMap
- a map to put into this onejava.lang.NullPointerException
- if the passed map is null or contains a null key or valuesjava.lang.IllegalStateException
- if this map is not validjava.lang.IllegalArgumentException
- if some property of the key or the value prevents it
from being stored in this mapjava.lang.UnsupportedOperationException
- if this map is read-onlyV get(K key)
null
if there is no mapping for the key.key
- a storage keynull
if this map contains no mapping for the key.java.lang.IllegalStateException
- if this map is not validvoid remove(K key)
key
- a storage keyjava.lang.IllegalStateException
- if this map is not validjava.lang.UnsupportedOperationException
- if this map is read-onlyjava.util.Iterator<K> keys()
Any destructive operation on the same Fork
this map uses
(but not necessarily on this map) will invalidate the iterator.
java.lang.IllegalStateException
- if this map is not validjava.util.Iterator<V> values()
Any destructive operation on the same Fork
this map uses
(but not necessarily on this map) will invalidate the iterator.
java.lang.IllegalStateException
- if this map is not validjava.util.Iterator<MapEntry<K,V>> entries()
Any destructive operation on the same Fork
this map uses
(but not necessarily on this map) will invalidate the iterator.
java.lang.IllegalStateException
- if this map is not validvoid clear()
java.lang.IllegalStateException
- if this map is not validjava.lang.UnsupportedOperationException
- if this map is read-onlydefault boolean isEmpty()
Note: there is no size()
method because
implementations of MapIndex do not currently track
the number of entries.
java.lang.String getName()
Copyright © 2018 Exonum. All rights reserved.