io.vertx.rxjava.core.shareddata

## Class LocalMap<K,V>

- java.lang.Object
- - io.vertx.rxjava.core.shareddata.LocalMap<K,V>

-     public class LocalMap<K,V>
      extends Object

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

  NOTE: This class has been automatically generated from the `io.vertx.core.shareddata.LocalMap original` non RX-ified interface using Vert.x codegen.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalMap(LocalMap delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clear all entries in the map
    `void` | `close()` Close and release the map
    `V` | `get(K key)` Get a value from the map
    `Object` | `getDelegate()`
    `boolean` | `isEmpty()`
    `static <K,V> LocalMap<K,V>` | `newInstance(LocalMap arg)`
    `V` | `put(K key, V value)` Put an entry in the map
    `V` | `putIfAbsent(K key, V value)` Put the entry only if there is no existing entry for that key
    `V` | `remove(K key)` Remove an entry from the map
    `boolean` | `removeIfPresent(K key, V value)` Remove the entry only if there is an entry with the specified key and value
    `V` | `replace(K key, V value)` Replace the entry only if there is an existing entry with the key
    `boolean` | `replaceIfPresent(K key, V oldValue, V newValue)` Replace the entry only if there is an existing entry with the specified key and value
    `int` | `size()` Get the size of the map

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LocalMap

          public LocalMap(LocalMap delegate)

  - ### Method Detail

    - #### getDelegate

          public Object getDelegate()

    - #### get

          public V get(K key)

      Get a value from the map
      Parameters:
        `key` - the key
      Returns:
        the value, or null if none

    - #### put

          public 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

    - #### remove

          public V remove(K key)

      Remove an entry from the map
      Parameters:
        `key` - the key
      Returns:
        the old value

    - #### clear

          public void clear()

      Clear all entries in the map

    - #### size

          public int size()

      Get the size of the map
      Returns:
        the number of entries in the map

    - #### isEmpty

          public boolean isEmpty()

      Returns:
        true if there are zero entries in the map

    - #### putIfAbsent

          public 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

    - #### removeIfPresent

          public boolean removeIfPresent(K key,
                                         V value)

      Remove the entry only if there is an entry with the specified key and value
      Parameters:
        `key` - the key
        `value` - the value
      Returns:
        true if removed

    - #### replaceIfPresent

          public boolean replaceIfPresent(K key,
                                          V oldValue,
                                          V newValue)

      Replace the entry only if there is an existing entry with the specified key and value
      Parameters:
        `key` - the key
        `oldValue` - the old value
        `newValue` - the new value
      Returns:
        true if removed

    - #### replace

          public 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

    - #### close

          public void close()

      Close and release the map

    - #### newInstance

          public static <K,V> LocalMap<K,V> newInstance(LocalMap arg)

Copyright © 2015. All Rights Reserved.