vertx-lang-scala-docs_2.12 3.9.1 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package core
  Definition Classes
    scala
-  package shareddata
  Definition Classes
    core
- AsyncMap
- Counter
- LocalMap
- Lock
- SharedData

c

io.vertx.scala.core.shareddata

# LocalMap 

###
Companion object LocalMap

#### 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.

Linear Supertypes
AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. LocalMap
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new LocalMap(_asJava: AnyRef)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[K], arg1: scala.reflect.api.JavaUniverse.TypeTag[V])

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def asJava: AnyRef
6.  def clear(): Unit

   Clear all entries in the map

7.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @native() @throws( ... )
8.  def close(): Unit

   Close and release the map

9.  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

10.  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`

11.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
12.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
13.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
14.  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

15.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
16.  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

17.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
18.  def isEmpty(): Boolean

    returns

      true if there are zero entries in the map

19.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
20.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
21.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
22.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
23.  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

24.  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

25.  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

26.  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

27.  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

28.  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

29.  def size(): Int

    Get the size of the map * @return the number of entries in the map

30.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
31.  def toString(): String
    Definition Classes
      AnyRef → Any
32.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
33.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
34.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @throws( ... )

### Inherited from AnyRef

### Inherited from Any

### Ungrouped