Package: io.vertx.groovy.core.shareddata

## [Groovy] Class AsyncMap<K, V>

- io.vertx.groovy.core.shareddata.AsyncMap

- An asynchronous map.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `AsyncMap (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `clear(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)` Clear all entries in the map
    `void` | `get(K k, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>> resultHandler)` Get a value from the map, asynchronously.
    `java.lang.Object` | `getDelegate()`
    `void` | `put(K k, V v, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> completionHandler)` Put a value in the map, asynchronously.
    `void` | `put(K k, V v, long ttl, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> completionHandler)` Like AsyncMap.put but specifying a time to live for the entry.
    `void` | `putIfAbsent(K k, V v, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>> completionHandler)` Put the entry only if there is no entry with the key already present.
    `void` | `putIfAbsent(K k, V v, long ttl, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>> completionHandler)` Link AsyncMap.putIfAbsent but specifying a time to live for the entry.
    `void` | `remove(K k, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>> resultHandler)` Remove a value from the map, asynchronously.
    `void` | `removeIfPresent(K k, V v, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>> resultHandler)` Remove a value from the map, only if entry already exists with same value.
    `void` | `replace(K k, V v, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>> resultHandler)` Replace the entry only if it is currently mapped to some value
    `void` | `replaceIfPresent(K k, V oldValue, V newValue, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>> resultHandler)` Replace the entry only if it is currently mapped to a specific value
    `void` | `size(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Integer>> resultHandler)` Provide the number of entries in the map

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### AsyncMap(java.lang.Object delegate)

  - ### Method Detail

    - #### void clear(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)

      Clear all entries in the map

      Parameters:
        `resultHandler` - called on completion

    - #### void get(K k, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>> resultHandler)

      Get a value from the map, asynchronously.

      Parameters:
        `k` - the key
        `resultHandler` - - this will be called some time later with the async result.

    - #### java.lang.Object getDelegate()

    - #### void put(K k, V v, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> completionHandler)

      Put a value in the map, asynchronously.

      Parameters:
        `k` - the key
        `v` - the value
        `completionHandler` - - this will be called some time later to signify the value has been put

    - #### void put(K k, V v, long ttl, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> completionHandler)

      Like AsyncMap.put but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.

      Parameters:
        `k` - the key
        `v` - the value
        `ttl` - The time to live (in ms) for the entry
        `completionHandler` - the handler

    - #### void putIfAbsent(K k, V v, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>> completionHandler)

      Put the entry only if there is no entry with the key already present. If key already present then the existing value will be returned to the handler, otherwise null.

      Parameters:
        `k` - the key
        `v` - the value
        `completionHandler` - the handler

    - #### void putIfAbsent(K k, V v, long ttl, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>> completionHandler)

      Link AsyncMap.putIfAbsent but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.

      Parameters:
        `k` - the key
        `v` - the value
        `ttl` - The time to live (in ms) for the entry
        `completionHandler` - the handler

    - #### void remove(K k, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>> resultHandler)

      Remove a value from the map, asynchronously.

      Parameters:
        `k` - the key
        `resultHandler` - - this will be called some time later to signify the value has been removed

    - #### void removeIfPresent(K k, V v, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>> resultHandler)

      Remove a value from the map, only if entry already exists with same value.

      Parameters:
        `k` - the key
        `v` - the value
        `resultHandler` - - this will be called some time later to signify the value has been removed

    - #### void replace(K k, V v, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>> resultHandler)

      Replace the entry only if it is currently mapped to some value

      Parameters:
        `k` - the key
        `v` - the new value
        `resultHandler` - the result handler will be passed the previous value

    - #### void replaceIfPresent(K k, V oldValue, V newValue, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>> resultHandler)

      Replace the entry only if it is currently mapped to a specific value

      Parameters:
        `k` - the key
        `oldValue` - the existing value
        `newValue` - the new value
        `resultHandler` - the result handler

    - #### void size(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Integer>> resultHandler)

      Provide the number of entries in the map

      Parameters:
        `resultHandler` - handler which will receive the number of entries