class LocalMap[K, V] extends AnyRef
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 io.vertx.scala.core.shareddata.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.
- Alphabetic
- By Inheritance
- LocalMap
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new LocalMap(_asJava: AnyRef)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[K], arg1: scala.reflect.api.JavaUniverse.TypeTag[V])
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJava: AnyRef
-
def
clear(): Unit
Clear all entries in the map
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
close(): Unit
Close and release the map
-
def
containsKey(key: AnyRef): Boolean
Returns
true
if this map contains a mapping for the specified key.Returns
true
if this map contains a mapping for the specified key. * @param key key whose presence in this map is to be tested- returns
true
if this map contains a mapping for the specified key
-
def
containsValue(value: AnyRef): Boolean
Returns @{code true
if this map maps one or more keys to the specified value. * @param value value whose presence in this map is to be tested
Returns @{code true
if this map maps one or more keys to the specified value. * @param value value whose presence in this map is to be tested
- returns
@{code true
if this map maps one or more keys to the specified value
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
get(key: AnyRef): V
Get a value from the map * @param key the key
Get a value from the map * @param key the key
- returns
the value, or null if none
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getOrDefault(key: AnyRef, defaultValue: V): V
Returns the value to which the specified key is mapped, or
defaultValue
if this map contains no mapping for the key.Returns the value to which the specified key is mapped, or
defaultValue
if this map contains no mapping for the key. * @param 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
defaultValue
if this map contains no mapping for the key
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
isEmpty(): Boolean
- returns
true if there are zero entries in the map
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
put(key: K, value: V): V
Put an entry in the map * @param key the key
Put an entry in the map * @param key the key
- value
the value
- returns
return the old value, or null if none
-
def
putIfAbsent(key: K, value: V): V
Put the entry only if there is no existing entry for that key * @param key the key
Put the entry only if there is no existing entry for that key * @param key the key
- value
the value
- returns
the old value or null, if none
-
def
remove(key: AnyRef): V
Remove an entry from the map * @param key the key
Remove an entry from the map * @param key the key
- returns
the old value
-
def
removeIfPresent(key: K, value: V): Boolean
Remove the entry only if there is an entry with the specified key and value.
Remove the entry only if there is an entry with the specified key and value.
This method is the poyglot version of io.vertx.scala.core.shareddata.LocalMap#remove. * @param key the key
- value
the value
- returns
true if removed
-
def
replace(key: K, value: V): V
Replace the entry only if there is an existing entry with the key * @param key the key
Replace the entry only if there is an existing entry with the key * @param key the key
- value
the new value
- returns
the old value
-
def
replaceIfPresent(key: K, oldValue: V, newValue: V): Boolean
Replace the entry only if there is an existing entry with the specified key and value.
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.scala.core.shareddata.LocalMap#replace. * @param key the key
- oldValue
the old value
- newValue
the new value
- returns
true if removed
-
def
size(): Int
Get the size of the map * @return the number of entries in the map
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )