public class EconomicMapWrap<K,V> extends Object implements EconomicMap<K,V>
Map as an EconomicMap.| Constructor and Description |
|---|
EconomicMapWrap(Map<K,V> map) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all of the mappings from this map.
|
boolean |
containsKey(K key)
Returns
true if this map contains a mapping for key. |
V |
get(K key)
Returns the value to which
key is mapped, or null if this map contains no
mapping for key. |
MapCursor<K,V> |
getEntries()
Returns a
MapCursor view of the mappings contained in this map. |
Iterable<K> |
getKeys()
Returns a
Iterable view of the keys contained in this map. |
Iterable<V> |
getValues()
Returns a
Iterable view of the values contained in this map. |
boolean |
isEmpty()
Returns
true if this map contains no key-value mappings. |
V |
put(K key,
V value)
Associates
value with key in this map. |
V |
putIfAbsent(K key,
V value)
If the specified key is not already associated with a value (or is mapped to
null)
associates it with the given value and returns null, else returns the current value. |
V |
removeKey(K key)
Removes the mapping for
key from this map if it is present. |
void |
replaceAll(BiFunction<? super K,? super V,? extends V> function)
Replaces each entry's value with the result of invoking
function on that entry until
all entries have been processed or the function throws an exception. |
int |
size()
Returns the number of key-value mappings in this map.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, create, create, create, create, create, putAll, putAll, wrapMapgetpublic V get(K key)
UnmodifiableEconomicMapkey is mapped, or null if this map contains no
mapping for key. The key must not be null.get in interface UnmodifiableEconomicMap<K,V>public V put(K key, V value)
EconomicMapvalue with key in this map. If the map previously contained a
mapping for key, the old value is replaced by value. While the value
may be null, the key must not be {code null}.put in interface EconomicMap<K,V>key, or null if there was no
mapping for key.public V putIfAbsent(K key, V value)
EconomicMapnull)
associates it with the given value and returns null, else returns the current value.putIfAbsent in interface EconomicMap<K,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keynull if there was no
mapping for the key. (A null return can also indicate that the map previously
associated null with the key, if the implementation supports null values.)public int size()
UnmodifiableEconomicMapsize in interface UnmodifiableEconomicMap<K,V>public boolean containsKey(K key)
UnmodifiableEconomicMaptrue if this map contains a mapping for key. Returns always
false if the key is null.containsKey in interface UnmodifiableEconomicMap<K,V>public void clear()
EconomicMapclear in interface EconomicMap<K,V>public V removeKey(K key)
EconomicMapkey from this map if it is present. The map will not contain
a mapping for key once the call returns. The key must not be null.removeKey in interface EconomicMap<K,V>key, or null if there was no
mapping for key.public Iterable<V> getValues()
UnmodifiableEconomicMapIterable view of the values contained in this map.getValues in interface UnmodifiableEconomicMap<K,V>public Iterable<K> getKeys()
UnmodifiableEconomicMapIterable view of the keys contained in this map.getKeys in interface UnmodifiableEconomicMap<K,V>public boolean isEmpty()
UnmodifiableEconomicMaptrue if this map contains no key-value mappings.isEmpty in interface UnmodifiableEconomicMap<K,V>public MapCursor<K,V> getEntries()
EconomicMapMapCursor view of the mappings contained in this map.getEntries in interface EconomicMap<K,V>getEntries in interface UnmodifiableEconomicMap<K,V>public void replaceAll(BiFunction<? super K,? super V,? extends V> function)
EconomicMapfunction on that entry until
all entries have been processed or the function throws an exception. Exceptions thrown by the
function are relayed to the caller.replaceAll in interface EconomicMap<K,V>