Class EconomicMapWrap<K,V>
java.lang.Object
org.graalvm.collections.EconomicMapWrap<K,V>
- All Implemented Interfaces:
EconomicMap<K,V>, UnmodifiableEconomicMap<K, V>
Wraps an existing
Map as an EconomicMap.- Since:
- 21.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all of the mappings from this map.booleancontainsKey(K key) Returnstrueif this map contains a mapping forkey.Returns the value to whichkeyis mapped, ornullif this map contains no mapping forkey.Returns aMapCursorview of the mappings contained in this map.getKeys()Returns aIterableview of the keys contained in this map.Returns aIterableview of the values contained in this map.booleanisEmpty()Returnstrueif this map contains no key-value mappings.Associatesvaluewithkeyin this map.putIfAbsent(K key, V value) If the specified key is not already associated with a value (or is mapped tonull) associates it with the given value and returnsnull, else returns the current value.Removes the mapping forkeyfrom this map if it is present.voidreplaceAll(BiFunction<? super K, ? super V, ? extends V> function) Replaces each entry's value with the result of invokingfunctionon that entry until all entries have been processed or the function throws an exception.intsize()Returns the number of key-value mappings in this map.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface EconomicMap
computeIfAbsent, putAll, putAllMethods inherited from interface UnmodifiableEconomicMap
get, getEquivalenceStrategy
-
Constructor Details
-
EconomicMapWrap
-
-
Method Details
-
get
Description copied from interface:UnmodifiableEconomicMapReturns the value to whichkeyis mapped, ornullif this map contains no mapping forkey. Thekeymust not benull.- Specified by:
getin interfaceUnmodifiableEconomicMap<K,V> - Since:
- 21.1
-
put
Description copied from interface:EconomicMapAssociatesvaluewithkeyin this map. If the map previously contained a mapping forkey, the old value is replaced byvalue. While thevaluemay benull, thekeymust not be {code null}.- Specified by:
putin interfaceEconomicMap<K,V> - Returns:
- the previous value associated with
key, ornullif there was no mapping forkey. - Since:
- 21.1
-
putIfAbsent
Description copied from interface:EconomicMapIf the specified key is not already associated with a value (or is mapped tonull) associates it with the given value and returnsnull, else returns the current value.- Specified by:
putIfAbsentin interfaceEconomicMap<K,V> - Parameters:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified key- Returns:
- the previous value associated with the specified key, or
nullif there was no mapping for the key. (Anullreturn can also indicate that the map previously associatednullwith the key, if the implementation supports null values.) - Since:
- 21.1
-
size
public int size()Description copied from interface:UnmodifiableEconomicMapReturns the number of key-value mappings in this map.- Specified by:
sizein interfaceUnmodifiableEconomicMap<K,V> - Since:
- 21.1
-
containsKey
Description copied from interface:UnmodifiableEconomicMapReturnstrueif this map contains a mapping forkey. Always returnsfalseif thekeyisnull.- Specified by:
containsKeyin interfaceUnmodifiableEconomicMap<K,V> - Since:
- 21.1
-
clear
public void clear()Description copied from interface:EconomicMapRemoves all of the mappings from this map. The map will be empty after this call returns.- Specified by:
clearin interfaceEconomicMap<K,V> - Since:
- 21.1
-
removeKey
Description copied from interface:EconomicMapRemoves the mapping forkeyfrom this map if it is present. The map will not contain a mapping forkeyonce the call returns. Thekeymust not benull.- Specified by:
removeKeyin interfaceEconomicMap<K,V> - Returns:
- the previous value associated with
key, ornullif there was no mapping forkey. - Since:
- 21.1
-
getValues
Description copied from interface:UnmodifiableEconomicMapReturns aIterableview of the values contained in this map.- Specified by:
getValuesin interfaceUnmodifiableEconomicMap<K,V> - Since:
- 21.1
-
getKeys
Description copied from interface:UnmodifiableEconomicMapReturns aIterableview of the keys contained in this map.- Specified by:
getKeysin interfaceUnmodifiableEconomicMap<K,V> - Since:
- 21.1
-
isEmpty
public boolean isEmpty()Description copied from interface:UnmodifiableEconomicMapReturnstrueif this map contains no key-value mappings.- Specified by:
isEmptyin interfaceUnmodifiableEconomicMap<K,V> - Since:
- 21.1
-
getEntries
Description copied from interface:EconomicMapReturns aMapCursorview of the mappings contained in this map.- Specified by:
getEntriesin interfaceEconomicMap<K,V> - Specified by:
getEntriesin interfaceUnmodifiableEconomicMap<K,V> - Since:
- 21.1
-
replaceAll
Description copied from interface:EconomicMapReplaces each entry's value with the result of invokingfunctionon that entry until all entries have been processed or the function throws an exception. Exceptions thrown by the function are relayed to the caller.- Specified by:
replaceAllin interfaceEconomicMap<K,V> - Since:
- 21.1
-
toString
-