vertx / io.vertx.reactivex.core.shareddata / LocalMap

LocalMap

open class LocalMap<K : Any, V : Any>

Local maps can be used to share data safely in a single Vert.x instance.

The map only allows immutable keys and values in the map, OR certain mutable objects such as io.vertx.reactivex.core.buffer.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.

Your own objects can be marked as immutable by implementing the io.vertx.reactivex.core.shareddata.Shareable interface. 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 io.vertx.core.shareddata.LocalMap non RX-ified interface using Vert.x codegen.

Constructors

<init>

LocalMap(delegate: LocalMap<Any, Any>)
LocalMap(delegate: LocalMap<Any, Any>, typeArg_0: TypeArg<K>, typeArg_1: TypeArg<V>)

Properties

__TYPE_ARG

static val __TYPE_ARG: TypeArg<LocalMap<Any, Any>>

__typeArg_0

val __typeArg_0: TypeArg<K>

__typeArg_1

val __typeArg_1: TypeArg<V>

Functions

clear

open fun clear(): Unit

Clear all entries in the map

close

open fun close(): Unit

Close and release the map

containsKey

open fun containsKey(key: Any): Boolean

Returns true if this map contains a mapping for the specified key.

containsValue

open fun containsValue(value: Any): Boolean

Returns @{code true} if this map maps one or more keys to the specified value.

equals

open fun equals(other: Any?): Boolean

get

open fun get(key: Any): V

Get a value from the map

getDelegate

open fun getDelegate(): LocalMap<Any, Any>

getOrDefault

open fun getOrDefault(key: Any, defaultValue: V): V

Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.

hashCode

open fun hashCode(): Int

isEmpty

open fun isEmpty(): Boolean

newInstance

open static fun <K : Any, V : Any> newInstance(arg: LocalMap<Any, Any>): LocalMap<K, V>
open static fun <K : Any, V : Any> newInstance(arg: LocalMap<Any, Any>, __typeArg_K: TypeArg<K>, __typeArg_V: TypeArg<V>): LocalMap<K, V>

put

open fun put(key: K, value: V): V

Put an entry in the map

putIfAbsent

open fun putIfAbsent(key: K, value: V): V

Put the entry only if there is no existing entry for that key

remove

open fun remove(key: Any): V

Remove an entry from the map

removeIfPresent

open fun removeIfPresent(key: K, value: V): Boolean

Remove the entry only if there is an entry with the specified key and value.

This method is the poyglot version of io.vertx.reactivex.core.shareddata.LocalMap#remove.

replace

open fun replace(key: K, value: V): V

Replace the entry only if there is an existing entry with the key

replaceIfPresent

open fun replaceIfPresent(key: K, oldValue: V, newValue: V): Boolean

Replace the entry only if there is an existing entry with the specified key and value.

This method is the polyglot version of io.vertx.reactivex.core.shareddata.LocalMap#replace.

size

open fun size(): Int

Get the size of the map

toString

open fun toString(): String