Top Description Fields Constructors Methods
org.graalvm.collections

public Class EconomicMapWrap<K, V>

extends Object
implements EconomicMap<K, V>
Class Inheritance
All Implemented Interfaces
org.graalvm.collections.EconomicMap, org.graalvm.collections.UnmodifiableEconomicMap
Imports
java.util.Iterator, .Map, java.util.function.BiFunction

Wraps an existing Map as an EconomicMap.
Since
21.1

Field Summary

Modifier and TypeField and Description
private final Map<K, V>

Constructor Summary

AccessConstructor and Description
public
EconomicMapWrap(Map<K, V> map)

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements org.graalvm.collections.EconomicMap.clear.

Removes all of the mappings from this map.

public boolean
containsKey(K key)

Implements org.graalvm.collections.UnmodifiableEconomicMap.containsKey.

Returns true if this map contains a mapping for key.

public V
get(K key)

Implements org.graalvm.collections.UnmodifiableEconomicMap.get.

Returns the value to which key is mapped, or null if this map contains no mapping for key.

public MapCursor<K, V>
getEntries()

Implements org.graalvm.collections.EconomicMap.getEntries.

Returns a MapCursor view of the mappings contained in this map.

public Iterable<K>
getKeys()

Implements org.graalvm.collections.UnmodifiableEconomicMap.getKeys.

Returns a Iterable view of the keys contained in this map.

public Iterable<V>
getValues()

Implements org.graalvm.collections.UnmodifiableEconomicMap.getValues.

Returns a Iterable view of the values contained in this map.

public boolean
isEmpty()

Implements org.graalvm.collections.UnmodifiableEconomicMap.isEmpty.

Returns true if this map contains no key-value mappings.

public V
put(K key, V value)

Implements org.graalvm.collections.EconomicMap.put.

Associates value with key in this map.

public V
putIfAbsent(K
key with which the specified value is to be associated
key
,
V
value to be associated with the specified key
value
)

Overrides default org.graalvm.collections.EconomicMap.putIfAbsent.

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.

public V
removeKey(K key)

Implements org.graalvm.collections.EconomicMap.removeKey.

Removes the mapping for key from this map if it is present.

public void
replaceAll(BiFunction<? super K, ? super V, ? extends V> function)

Implements org.graalvm.collections.EconomicMap.replaceAll.

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.

public int
size()

Implements org.graalvm.collections.UnmodifiableEconomicMap.size.

Returns the number of key-value mappings in this map.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

mapback to summary
private final Map<K, V> map

Constructor Detail

EconomicMapWrapback to summary
public EconomicMapWrap(Map<K, V> map)
Since
21.1

Method Detail

clearback to summary
public void clear()

Implements org.graalvm.collections.EconomicMap.clear.

Doc from org.graalvm.collections.EconomicMap.clear.

Removes all of the mappings from this map. The map will be empty after this call returns.

Annotations
@Override
Since
21.1
containsKeyback to summary
public boolean containsKey(K key)

Implements org.graalvm.collections.UnmodifiableEconomicMap.containsKey.

Doc from org.graalvm.collections.UnmodifiableEconomicMap.containsKey.

Returns true if this map contains a mapping for key. Always returns false if the key is null.

Annotations
@Override
Since
21.1
getback to summary
public V get(K key)

Implements org.graalvm.collections.UnmodifiableEconomicMap.get.

Doc from org.graalvm.collections.UnmodifiableEconomicMap.get.

Returns the value to which key is mapped, or null if this map contains no mapping for key. The key must not be null.

Annotations
@Override
Since
21.1
getEntriesback to summary
public MapCursor<K, V> getEntries()

Implements org.graalvm.collections.EconomicMap.getEntries.

Doc from org.graalvm.collections.EconomicMap.getEntries.

Returns a MapCursor view of the mappings contained in this map.

Annotations
@Override
Since
21.1
getKeysback to summary
public Iterable<K> getKeys()

Implements org.graalvm.collections.UnmodifiableEconomicMap.getKeys.

Doc from org.graalvm.collections.UnmodifiableEconomicMap.getKeys.

Returns a Iterable view of the keys contained in this map.

Annotations
@Override
Since
21.1
getValuesback to summary
public Iterable<V> getValues()

Implements org.graalvm.collections.UnmodifiableEconomicMap.getValues.

Doc from org.graalvm.collections.UnmodifiableEconomicMap.getValues.

Returns a Iterable view of the values contained in this map.

Annotations
@Override
Since
21.1
isEmptyback to summary
public boolean isEmpty()

Implements org.graalvm.collections.UnmodifiableEconomicMap.isEmpty.

Doc from org.graalvm.collections.UnmodifiableEconomicMap.isEmpty.

Returns true if this map contains no key-value mappings.

Annotations
@Override
Since
21.1
putback to summary
public V put(K key, V value)

Implements org.graalvm.collections.EconomicMap.put.

Doc from org.graalvm.collections.EconomicMap.put.

Associates value 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}.

Returns:V

the previous value associated with key, or null if there was no mapping for key.

Annotations
@Override
Since
21.1
putIfAbsentback to summary
public V putIfAbsent(K key, V value)

Overrides default org.graalvm.collections.EconomicMap.putIfAbsent.

Doc from org.graalvm.collections.EconomicMap.putIfAbsent.

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.

Parameters
key:K

key with which the specified value is to be associated

value:V

value to be associated with the specified key

Returns:V

the previous value associated with the specified key, or null 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.)

Annotations
@Override
Since
21.1
removeKeyback to summary
public V removeKey(K key)

Implements org.graalvm.collections.EconomicMap.removeKey.

Doc from org.graalvm.collections.EconomicMap.removeKey.

Removes the mapping for key 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.

Returns:V

the previous value associated with key, or null if there was no mapping for key.

Annotations
@Override
Since
21.1
replaceAllback to summary
public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function)

Implements org.graalvm.collections.EconomicMap.replaceAll.

Doc from org.graalvm.collections.EconomicMap.replaceAll.

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. Exceptions thrown by the function are relayed to the caller.

Annotations
@Override
Since
21.1
sizeback to summary
public int size()

Implements org.graalvm.collections.UnmodifiableEconomicMap.size.

Doc from org.graalvm.collections.UnmodifiableEconomicMap.size.

Returns the number of key-value mappings in this map.

Annotations
@Override
Since
21.1
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
Since
23.1