By default the map allows immutable keys and values.
Custom keys and values should implement Shareable interface. The map returns their copies.
This ensures there is no shared access to mutable state from different threads (e.g. different event loops) in the Vert.x instance, and means you don't have to protect access to that state using synchronization or locks.
Since the version 3.4, this class extends the Map interface. However some methods are only accessible in Java.
Shareable
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public V | Returns: the new value associated with the specified key, or null if nonekey with which the specified value is to be associated key, BiFunction<? super K, ? super V, ? extends V> the function to compute a value remappingFunction)Redeclares as abstract: java. Attempts to compute a mapping for the specified key and its current
mapped value (or |
| public V | Returns: the current (existing or computed) value associated with the specified key, or null if the computed value is nullkey with which the specified value is to be associated key, Function<? super K, ? extends V> the function to compute a value mappingFunction)Redeclares as abstract: java. If the specified key is not already associated with a value (or is mapped
to |
| public V | Returns: the new value associated with the specified key, or null if nonekey with which the specified value is to be associated key, BiFunction<? super K, ? super V, ? extends V> the function to compute a value remappingFunction)Redeclares as abstract: java. If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value. |
| public boolean | Returns: true if this map contains a mapping for the specified keykey whose presence in this map is to be tested key)Redeclares java. Returns |
| public boolean | Returns: @{code true} if this map maps one or more keys to the specified valuevalue whose presence in this map is to be tested value)Redeclares java. Returns @{code true} if this map maps one or more keys to the specified value. |
| public Set | Returns: a set view of the mappings contained in this mapRedeclares java. Returns a |
| public void | forEach(BiConsumer<? super K, ? super V>
The action to be performed for each entry action)Redeclares as abstract: java. Performs the given action for each entry in this map until all entries have been processed or the action throws an exception. |
| public V | Returns: the value, or null if nonethe key key)Redeclares java. Get a value from the map |
| public V | Returns: the value to which the specified key is mapped, ordefaultValue if this map contains no mapping
for the keythe key whose associated value is to be returned key, V the default mapping of the key defaultValue)Redeclares as abstract: java. Returns the value to which the specified key is mapped, or
|
| public boolean | Returns: true if there are zero entries in the mapRedeclares java. Returns |
| public Set | Returns: the set of keys in the mapRedeclares java. Returns a |
| public V | Returns: the new value associated with the specified key, or null if no value is associated with the keykey with which the resulting value is to be associated key, V the non-null value to be merged with the existing value
associated with the key or, if no existing value or a null value
is associated with the key, to be associated with the key value, BiFunction<? super V, ? super V, ? extends V> the function to recompute a value if present remappingFunction)Redeclares as abstract: java. If the specified key is not already associated with a value or is associated with null, associates it with the given non-null value. |
| public V | Returns: return the old value, or null if nonethe key key, V the value value)Redeclares java. Put an entry in the map |
| public void | putAll(Map<? extends K, ? extends V>
mappings to be stored in this map m)Redeclares java. Copies all of the mappings from the specified map to this map. |
| public V | Returns: the old value or null, if nonethe key key, V the value value)Redeclares as abstract: java. Put the entry only if there is no existing entry for that key |
| public V | Returns: the old valuethe key key)Redeclares java. Remove an entry from the map |
| public boolean | Returns: true if the value was removedkey with which the specified value is associated key, Object value expected to be associated with the specified key value)Redeclares as abstract: java. Removes the entry for the specified key only if it is currently mapped to the specified value. |
| public boolean | Returns: true if removedthe key key, V the value value)Remove the entry only if there is an entry with the specified key and value. |
| public V | Returns: the old valuethe key key, V the new value value)Redeclares as abstract: java. Replace the entry only if there is an existing entry with the key |
| public boolean | Returns: true if the value was replacedkey with which the specified value is associated key, V value expected to be associated with the specified key oldValue, V value to be associated with the specified key newValue)Redeclares as abstract: java. Replaces the entry for the specified key only if currently mapped to the specified value. |
| public void | replaceAll(BiFunction<? super K, ? super V, ? extends V>
the function to apply to each entry function)Redeclares as abstract: java. Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception. |
| public boolean | Returns: true if removedthe key key, V the old value oldValue, V the new value newValue)Replace the entry only if there is an existing entry with the specified key and value. |
| public int | Returns: the number of entries in the mapRedeclares java. Get the size of the map |
| public Collection | Returns: the set of values in the mapRedeclares java. Returns a |
| clear | back to summary |
|---|---|
| public void clear() Redeclares java. Clear all entries in the map | |
| close | back to summary |
|---|---|
| public void close() Close and release the map | |
| compute | back to summary |
|---|---|
| public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Redeclares as abstract: java. Attempts to compute a mapping for the specified key and its current
mapped value (or
If the function returns
| |
| computeIfAbsent | back to summary |
|---|---|
| public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) Redeclares as abstract: java. If the specified key is not already associated with a value (or is mapped
to
If the function returns
| |
| computeIfPresent | back to summary |
|---|---|
| public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Redeclares as abstract: java. If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value.
If the function returns
| |
| containsKey | back to summary |
|---|---|
| public boolean containsKey(Object key) Redeclares java. Returns | |
| containsValue | back to summary |
|---|---|
| public boolean containsValue(Object value) Redeclares java. Returns @{code true} if this map maps one or more keys to the specified value. | |
| entrySet | back to summary |
|---|---|
| public Set Redeclares java. Returns a
Unlike the default | |
| forEach | back to summary |
|---|---|
| public void forEach(BiConsumer<? super K, ? super V> action) Redeclares as abstract: java. Performs the given action for each entry in this map until all entries have been processed or the action throws an exception. Exceptions thrown by the action are relayed to the caller.
| |
| get | back to summary |
|---|---|
| public V get(Object key) Redeclares java. Get a value from the map
| |
| getOrDefault | back to summary |
|---|---|
| public V getOrDefault(Object key, V defaultValue) Redeclares as abstract: java. Returns the value to which the specified key is mapped, or
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Redeclares java. Doc from java. Returns
| |
| keySet | back to summary |
|---|---|
| public Set Redeclares java. Doc from java. Returns a
| |
| merge | back to summary |
|---|---|
| public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) Redeclares as abstract: java. If the specified key is not already associated with a value or is
associated with null, associates it with the given non-null value.
Otherwise, replaces the associated value with the results of the given
remapping function, or removes if the result is
| |
| put | back to summary |
|---|---|
| public V put(K key, V value) Redeclares java. Put an entry in the map
| |
| putAll | back to summary |
|---|---|
| public void putAll(Map<? extends K, ? extends V> m) Redeclares java. Copies all of the mappings from the specified map to this map. The effect of this call is equivalent to that
of calling
| |
| putIfAbsent | back to summary |
|---|---|
| public V putIfAbsent(K key, V value) Redeclares as abstract: java. Put the entry only if there is no existing entry for that key
| |
| remove | back to summary |
|---|---|
| public V remove(Object key) Redeclares java. Remove an entry from the map
| |
| remove | back to summary |
|---|---|
| public boolean remove(Object key, Object value) Redeclares as abstract: java. Removes the entry for the specified key only if it is currently mapped to the specified value.
| |
| removeIfPresent | back to summary |
|---|---|
| public boolean removeIfPresent(K key, V value) Remove the entry only if there is an entry with the specified key and value.
This method is the poyglot version of
| |
| replace | back to summary |
|---|---|
| public V replace(K key, V value) Redeclares as abstract: java. Replace the entry only if there is an existing entry with the key
| |
| replace | back to summary |
|---|---|
| public boolean replace(K key, V oldValue, V newValue) Redeclares as abstract: java. Replaces the entry for the specified key only if currently mapped to the specified value.
| |
| replaceAll | back to summary |
|---|---|
| public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) Redeclares as abstract: java. Replaces each entry's value with the result of invoking the given 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.
| |
| replaceIfPresent | back to summary |
|---|---|
| public boolean replaceIfPresent(K key, V oldValue, V newValue) Replace the entry only if there is an existing entry with the specified key and value.
This method is the polyglot version of
| |
| size | back to summary |
|---|---|
| public int size() Redeclares java. Get the size of the map
| |
| values | back to summary |
|---|---|
| public Collection Redeclares java. Doc from java. Returns a
| |