public class LocalMap<K,V> extends Object
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 interface. However some methods are only accessible in Java.
NOTE: This class has been automatically generated from theoriginal
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<LocalMap> |
__TYPE_ARG |
io.vertx.lang.rx.TypeArg<K> |
__typeArg_0 |
io.vertx.lang.rx.TypeArg<V> |
__typeArg_1 |
Constructor and Description |
---|
LocalMap(LocalMap delegate) |
LocalMap(Object delegate,
io.vertx.lang.rx.TypeArg<K> typeArg_0,
io.vertx.lang.rx.TypeArg<V> typeArg_1) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all entries in the map
|
void |
close()
Close and release the map
|
boolean |
containsKey(Object key)
Returns
true if this map contains a mapping for the specified
key. |
boolean |
containsValue(Object value)
Returns @{code true} if this map maps one or more keys to the
specified value.
|
boolean |
equals(Object o) |
V |
get(Object key)
Get a value from the map
|
LocalMap |
getDelegate() |
V |
getOrDefault(Object key,
V defaultValue)
Returns the value to which the specified key is mapped, or
defaultValue if this map contains no mapping for the key. |
int |
hashCode() |
boolean |
isEmpty() |
static <K,V> LocalMap<K,V> |
newInstance(LocalMap arg) |
static <K,V> LocalMap<K,V> |
newInstance(LocalMap arg,
io.vertx.lang.rx.TypeArg<K> __typeArg_K,
io.vertx.lang.rx.TypeArg<V> __typeArg_V) |
V |
put(K key,
V value)
Put an entry in the map
|
V |
putIfAbsent(K key,
V value)
Put the entry only if there is no existing entry for that key
|
V |
remove(Object key)
Remove an entry from the map
|
boolean |
removeIfPresent(K key,
V value)
Remove the entry only if there is an entry with the specified key and value.
|
V |
replace(K key,
V value)
Replace the entry only if there is an existing entry with the key
|
boolean |
replaceIfPresent(K key,
V oldValue,
V newValue)
Replace the entry only if there is an existing entry with the specified key and value.
|
int |
size()
Get the size of the map
|
String |
toString() |
public static final io.vertx.lang.rx.TypeArg<LocalMap> __TYPE_ARG
public final io.vertx.lang.rx.TypeArg<K> __typeArg_0
public final io.vertx.lang.rx.TypeArg<V> __typeArg_1
public LocalMap(LocalMap delegate)
public LocalMap getDelegate()
public V get(Object key)
key
- the keypublic V put(K key, V value)
key
- the keyvalue
- the valuepublic V remove(Object key)
key
- the keypublic void clear()
public int size()
public boolean isEmpty()
public V putIfAbsent(K key, V value)
key
- the keyvalue
- the valuepublic boolean removeIfPresent(K key, V value)
This method is the poyglot version of remove(java.lang.Object)
.
key
- the keyvalue
- the valuepublic boolean replaceIfPresent(K key, V oldValue, V newValue)
This method is the polyglot version of replace(K, V)
.
key
- the keyoldValue
- the old valuenewValue
- the new valuepublic V replace(K key, V value)
key
- the keyvalue
- the new valuepublic void close()
public boolean containsKey(Object key)
true
if this map contains a mapping for the specified
key.key
- key whose presence in this map is to be testedtrue
if this map contains a mapping for the specified keypublic boolean containsValue(Object value)
value
- value whose presence in this map is to be testedpublic V getOrDefault(Object key, V defaultValue)
defaultValue
if this map contains no mapping for the key.key
- the key whose associated value is to be returneddefaultValue
- the default mapping of the keydefaultValue
if this map contains no mapping for the keyCopyright © 2023 Eclipse. All rights reserved.