public interface LocalMap<K,V>
The map only allows immutable keys and values in the map, OR certain mutable objects such as Buffer
instances which will be copied when they are added to the map.
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.
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all entries in the map
|
void |
close()
Close and release the map
|
V |
get(K key)
Get a value from the map
|
boolean |
isEmpty() |
Set<K> |
keySet() |
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(K 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
|
Collection<V> |
values() |
V get(K key)
key
- the keyV put(K key, V value)
key
- the keyvalue
- the valueV remove(K key)
key
- the keyvoid clear()
int size()
boolean isEmpty()
V putIfAbsent(K key, V value)
key
- the keyvalue
- the valueboolean removeIfPresent(K key, V value)
key
- the keyvalue
- the valueboolean replaceIfPresent(K key, V oldValue, V newValue)
key
- the keyoldValue
- the old valuenewValue
- the new valueV replace(K key, V value)
key
- the keyvalue
- the new valuevoid close()
Collection<V> values()
Copyright © 2016. All rights reserved.