Class LocalMap<K,V>
- java.lang.Object
- 
- io.vertx.reactivex.core.shareddata.LocalMap<K,V>
 
- 
- All Implemented Interfaces:
- io.vertx.lang.rx.RxDelegate
 
 public class LocalMap<K,V> extends Object implements io.vertx.lang.rx.RxDelegate 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 Shareableinterface. 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 the originalnon RX-ified interface using Vert.x codegen.
- 
- 
Field SummaryFields Modifier and Type Field Description static io.vertx.lang.rx.TypeArg<LocalMap>__TYPE_ARGio.vertx.lang.rx.TypeArg<K>__typeArg_0io.vertx.lang.rx.TypeArg<V>__typeArg_1
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all entries in the mapvoidclose()Close and release the mapbooleancontainsKey(Object key)Returnstrueif this map contains a mapping for the specified key.booleancontainsValue(Object value)Returns @{code true} if this map maps one or more keys to the specified value.booleanequals(Object o)Vget(Object key)Get a value from the mapLocalMapgetDelegate()VgetOrDefault(Object key, V defaultValue)Returns the value to which the specified key is mapped, ordefaultValueif this map contains no mapping for the key.inthashCode()booleanisEmpty()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)Vput(K key, V value)Put an entry in the mapVputIfAbsent(K key, V value)Put the entry only if there is no existing entry for that keyVremove(Object key)Remove an entry from the mapbooleanremoveIfPresent(K key, V value)Remove the entry only if there is an entry with the specified key and value.Vreplace(K key, V value)Replace the entry only if there is an existing entry with the keybooleanreplaceIfPresent(K key, V oldValue, V newValue)Replace the entry only if there is an existing entry with the specified key and value.intsize()Get the size of the mapStringtoString()
 
- 
- 
- 
Method Detail- 
getDelegatepublic LocalMap getDelegate() - Specified by:
- getDelegatein interface- io.vertx.lang.rx.RxDelegate
 
 - 
getpublic V get(Object key) Get a value from the map- Parameters:
- key- the key
- Returns:
- the value, or null if none
 
 - 
putpublic V put(K key, V value) Put an entry in the map- Parameters:
- key- the key
- value- the value
- Returns:
- return the old value, or null if none
 
 - 
removepublic V remove(Object key) Remove an entry from the map- Parameters:
- key- the key
- Returns:
- the old value
 
 - 
clearpublic void clear() Clear all entries in the map
 - 
sizepublic int size() Get the size of the map- Returns:
- the number of entries in the map
 
 - 
isEmptypublic boolean isEmpty() - Returns:
- true if there are zero entries in the map
 
 - 
putIfAbsentpublic V putIfAbsent(K key, V value) Put the entry only if there is no existing entry for that key- Parameters:
- key- the key
- value- the value
- Returns:
- the old value or null, if none
 
 - 
removeIfPresentpublic 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 remove(java.lang.Object).- Parameters:
- key- the key
- value- the value
- Returns:
- true if removed
 
 - 
replaceIfPresentpublic 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 replace(K, V).- Parameters:
- key- the key
- oldValue- the old value
- newValue- the new value
- Returns:
- true if removed
 
 - 
replacepublic V replace(K key, V value) Replace the entry only if there is an existing entry with the key- Parameters:
- key- the key
- value- the new value
- Returns:
- the old value
 
 - 
closepublic void close() Close and release the map
 - 
containsKeypublic boolean containsKey(Object key) Returnstrueif this map contains a mapping for the specified key.- Parameters:
- key- key whose presence in this map is to be tested
- Returns:
- trueif this map contains a mapping for the specified key
 
 - 
containsValuepublic boolean containsValue(Object value) Returns @{code true} if this map maps one or more keys to the specified value.- Parameters:
- value- value whose presence in this map is to be tested
- Returns:
 
 - 
getOrDefaultpublic V getOrDefault(Object key, V defaultValue) Returns the value to which the specified key is mapped, ordefaultValueif this map contains no mapping for the key.- Parameters:
- key- the key whose associated value is to be returned
- defaultValue- the default mapping of the key
- Returns:
- the value to which the specified key is mapped, or defaultValueif this map contains no mapping for the key
 
 
- 
 
-