Package io.vertx.mutiny.core.shareddata
Class LocalMap<K,V>
java.lang.Object
io.vertx.mutiny.core.shareddata.LocalMap<K,V>
- All Implemented Interfaces:
MutinyDelegate
Local maps can be used to share data safely in a single Vert.x instance.
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 Mutiny-ified interface using Vert.x codegen.-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
void
close()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) boolean
io.vertx.core.shareddata.LocalMap
getOrDefault
(Object key, V defaultValue) int
hashCode()
boolean
isEmpty()
static <K,
V> LocalMap<K, V> newInstance
(io.vertx.core.shareddata.LocalMap arg) static <K,
V> LocalMap<K, V> newInstance
(io.vertx.core.shareddata.LocalMap arg, TypeArg<K> __typeArg_K, TypeArg<V> __typeArg_V) putIfAbsent
(K key, V value) boolean
removeIfPresent
(K key, V value) boolean
replaceIfPresent
(K key, V oldValue, V newValue) int
size()
toString()
-
Field Details
-
__TYPE_ARG
-
__typeArg_0
-
__typeArg_1
-
-
Constructor Details
-
LocalMap
-
Method Details
-
getDelegate
public io.vertx.core.shareddata.LocalMap getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
get
- Parameters:
key
- the key- Returns:
- the value, or null if none
-
put
- Parameters:
key
- the keyvalue
- the value- Returns:
- return the old value, or null if none
-
remove
- Parameters:
key
- the key- Returns:
- the old value
-
clear
public void clear() -
size
public int size()- Returns:
- the number of entries in the map
-
isEmpty
public boolean isEmpty()- Returns:
- true if there are zero entries in the map
-
putIfAbsent
- Parameters:
key
- the keyvalue
- the value- Returns:
- the old value or null, if none
-
removeIfPresent
- Parameters:
key
- the keyvalue
- the value- Returns:
- true if removed
-
replaceIfPresent
- Parameters:
key
- the keyoldValue
- the old valuenewValue
- the new value- Returns:
- true if removed
-
replace
- Parameters:
key
- the keyvalue
- the new value- Returns:
- the old value
-
close
public void close() -
containsKey
- Parameters:
key
- key whose presence in this map is to be tested- Returns:
true
if this map contains a mapping for the specified key
-
containsValue
- Parameters:
value
- value whose presence in this map is to be tested- Returns:
-
getOrDefault
- Parameters:
key
- the key whose associated value is to be returneddefaultValue
- the default mapping of the key- Returns:
- the value to which the specified key is mapped, or
defaultValue
if this map contains no mapping for the key
-