Class AsyncMap<K,V>
- java.lang.Object
-
- io.vertx.reactivex.core.shareddata.AsyncMap<K,V>
-
public class AsyncMap<K,V> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<AsyncMap>
__TYPE_ARG
TypeArg<K>
__typeArg_0
TypeArg<V>
__typeArg_1
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear all entries in the mapvoid
clear(Handler<AsyncResult<Void>> resultHandler)
Clear all entries in the mapboolean
equals(Object o)
void
get(K k)
Get a value from the map, asynchronously.void
get(K k, Handler<AsyncResult<V>> resultHandler)
Get a value from the map, asynchronously.AsyncMap
getDelegate()
int
hashCode()
void
keys()
Get the keys of the map, asynchronously.void
keys(Handler<AsyncResult<Set<K>>> resultHandler)
Get the keys of the map, asynchronously.static <K,V>
AsyncMap<K,V>newInstance(AsyncMap arg)
static <K,V>
AsyncMap<K,V>newInstance(AsyncMap arg, TypeArg<K> __typeArg_K, TypeArg<V> __typeArg_V)
void
put(K k, V v)
Put a value in the map, asynchronously.void
put(K k, V v, long ttl)
Likeput(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but specifying a time to live for the entry.void
put(K k, V v, long ttl, Handler<AsyncResult<Void>> completionHandler)
Likeput(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but specifying a time to live for the entry.void
put(K k, V v, Handler<AsyncResult<Void>> completionHandler)
Put a value in the map, asynchronously.void
putIfAbsent(K k, V v)
Put the entry only if there is no entry with the key already present.void
putIfAbsent(K k, V v, long ttl)
LinkputIfAbsent(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>>)
but specifying a time to live for the entry.void
putIfAbsent(K k, V v, long ttl, Handler<AsyncResult<V>> completionHandler)
LinkputIfAbsent(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>>)
but specifying a time to live for the entry.void
putIfAbsent(K k, V v, Handler<AsyncResult<V>> completionHandler)
Put the entry only if there is no entry with the key already present.void
remove(K k)
Remove a value from the map, asynchronously.void
remove(K k, Handler<AsyncResult<V>> resultHandler)
Remove a value from the map, asynchronously.void
removeIfPresent(K k, V v)
Remove a value from the map, only if entry already exists with same value.void
removeIfPresent(K k, V v, Handler<AsyncResult<Boolean>> resultHandler)
Remove a value from the map, only if entry already exists with same value.void
replace(K k, V v)
Replace the entry only if it is currently mapped to some valuevoid
replace(K k, V v, long ttl)
Replace the entry only if it is currently mapped to some valuevoid
replace(K k, V v, long ttl, Handler<AsyncResult<V>> resultHandler)
Replace the entry only if it is currently mapped to some valuevoid
replace(K k, V v, Handler<AsyncResult<V>> resultHandler)
Replace the entry only if it is currently mapped to some valuevoid
replaceIfPresent(K k, V oldValue, V newValue)
Replace the entry only if it is currently mapped to a specific valuevoid
replaceIfPresent(K k, V oldValue, V newValue, long ttl)
Replace the entry only if it is currently mapped to a specific valuevoid
replaceIfPresent(K k, V oldValue, V newValue, long ttl, Handler<AsyncResult<Boolean>> resultHandler)
Replace the entry only if it is currently mapped to a specific valuevoid
replaceIfPresent(K k, V oldValue, V newValue, Handler<AsyncResult<Boolean>> resultHandler)
Replace the entry only if it is currently mapped to a specific valueio.reactivex.Completable
rxClear()
Clear all entries in the mapio.reactivex.Maybe<V>
rxGet(K k)
Get a value from the map, asynchronously.io.reactivex.Single<Set<K>>
rxKeys()
Get the keys of the map, asynchronously.io.reactivex.Completable
rxPut(K k, V v)
Put a value in the map, asynchronously.io.reactivex.Completable
rxPut(K k, V v, long ttl)
Likeput(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but specifying a time to live for the entry.io.reactivex.Maybe<V>
rxPutIfAbsent(K k, V v)
Put the entry only if there is no entry with the key already present.io.reactivex.Maybe<V>
rxPutIfAbsent(K k, V v, long ttl)
LinkputIfAbsent(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>>)
but specifying a time to live for the entry.io.reactivex.Maybe<V>
rxRemove(K k)
Remove a value from the map, asynchronously.io.reactivex.Single<Boolean>
rxRemoveIfPresent(K k, V v)
Remove a value from the map, only if entry already exists with same value.io.reactivex.Maybe<V>
rxReplace(K k, V v)
Replace the entry only if it is currently mapped to some valueio.reactivex.Maybe<V>
rxReplace(K k, V v, long ttl)
Replace the entry only if it is currently mapped to some valueio.reactivex.Single<Boolean>
rxReplaceIfPresent(K k, V oldValue, V newValue)
Replace the entry only if it is currently mapped to a specific valueio.reactivex.Single<Boolean>
rxReplaceIfPresent(K k, V oldValue, V newValue, long ttl)
Replace the entry only if it is currently mapped to a specific valueio.reactivex.Single<Integer>
rxSize()
Provide the number of entries in the mapio.reactivex.Single<List<V>>
rxValues()
Get the values of the map, asynchronously.void
size()
Provide the number of entries in the mapvoid
size(Handler<AsyncResult<Integer>> resultHandler)
Provide the number of entries in the mapString
toString()
void
values()
Get the values of the map, asynchronously.void
values(Handler<AsyncResult<List<V>>> resultHandler)
Get the values of the map, asynchronously.
-
-
-
Method Detail
-
getDelegate
public AsyncMap getDelegate()
-
get
public void get(K k, Handler<AsyncResult<V>> resultHandler)
Get a value from the map, asynchronously.- Parameters:
k
- the keyresultHandler
- - this will be called some time later with the async result.
-
get
public void get(K k)
Get a value from the map, asynchronously.- Parameters:
k
- the key
-
rxGet
public io.reactivex.Maybe<V> rxGet(K k)
Get a value from the map, asynchronously.- Parameters:
k
- the key- Returns:
-
put
public void put(K k, V v, Handler<AsyncResult<Void>> completionHandler)
Put a value in the map, asynchronously.- Parameters:
k
- the keyv
- the valuecompletionHandler
- - this will be called some time later to signify the value has been put
-
put
public void put(K k, V v)
Put a value in the map, asynchronously.- Parameters:
k
- the keyv
- the value
-
rxPut
public io.reactivex.Completable rxPut(K k, V v)
Put a value in the map, asynchronously.- Parameters:
k
- the keyv
- the value- Returns:
-
put
public void put(K k, V v, long ttl, Handler<AsyncResult<Void>> completionHandler)
Likeput(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.- Parameters:
k
- the keyv
- the valuettl
- The time to live (in ms) for the entrycompletionHandler
- the handler
-
put
public void put(K k, V v, long ttl)
Likeput(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.- Parameters:
k
- the keyv
- the valuettl
- The time to live (in ms) for the entry
-
rxPut
public io.reactivex.Completable rxPut(K k, V v, long ttl)
Likeput(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.- Parameters:
k
- the keyv
- the valuettl
- The time to live (in ms) for the entry- Returns:
-
putIfAbsent
public void putIfAbsent(K k, V v, Handler<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 keyv
- the valuecompletionHandler
- the handler
-
putIfAbsent
public void putIfAbsent(K k, V v)
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 keyv
- the value
-
rxPutIfAbsent
public io.reactivex.Maybe<V> rxPutIfAbsent(K k, V v)
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 keyv
- the value- Returns:
-
putIfAbsent
public void putIfAbsent(K k, V v, long ttl, Handler<AsyncResult<V>> completionHandler)
LinkputIfAbsent(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>>)
but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.- Parameters:
k
- the keyv
- the valuettl
- The time to live (in ms) for the entrycompletionHandler
- the handler
-
putIfAbsent
public void putIfAbsent(K k, V v, long ttl)
LinkputIfAbsent(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>>)
but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.- Parameters:
k
- the keyv
- the valuettl
- The time to live (in ms) for the entry
-
rxPutIfAbsent
public io.reactivex.Maybe<V> rxPutIfAbsent(K k, V v, long ttl)
LinkputIfAbsent(K, V, io.vertx.core.Handler<io.vertx.core.AsyncResult<V>>)
but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.- Parameters:
k
- the keyv
- the valuettl
- The time to live (in ms) for the entry- Returns:
-
remove
public void remove(K k, Handler<AsyncResult<V>> resultHandler)
Remove a value from the map, asynchronously.- Parameters:
k
- the keyresultHandler
- - this will be called some time later to signify the value has been removed
-
remove
public void remove(K k)
Remove a value from the map, asynchronously.- Parameters:
k
- the key
-
rxRemove
public io.reactivex.Maybe<V> rxRemove(K k)
Remove a value from the map, asynchronously.- Parameters:
k
- the key- Returns:
-
removeIfPresent
public void removeIfPresent(K k, V v, Handler<AsyncResult<Boolean>> resultHandler)
Remove a value from the map, only if entry already exists with same value.- Parameters:
k
- the keyv
- the valueresultHandler
- - this will be called some time later to signify the value has been removed
-
removeIfPresent
public void removeIfPresent(K k, V v)
Remove a value from the map, only if entry already exists with same value.- Parameters:
k
- the keyv
- the value
-
rxRemoveIfPresent
public io.reactivex.Single<Boolean> rxRemoveIfPresent(K k, V v)
Remove a value from the map, only if entry already exists with same value.- Parameters:
k
- the keyv
- the value- Returns:
-
replace
public void replace(K k, V v, Handler<AsyncResult<V>> resultHandler)
Replace the entry only if it is currently mapped to some value- Parameters:
k
- the keyv
- the new valueresultHandler
- the result handler will be passed the previous value
-
replace
public void replace(K k, V v)
Replace the entry only if it is currently mapped to some value- Parameters:
k
- the keyv
- the new value
-
rxReplace
public io.reactivex.Maybe<V> rxReplace(K k, V v)
Replace the entry only if it is currently mapped to some value- Parameters:
k
- the keyv
- the new value- Returns:
-
replace
public void replace(K k, V v, long ttl, Handler<AsyncResult<V>> resultHandler)
Replace the entry only if it is currently mapped to some value- Parameters:
k
- the keyv
- the new valuettl
- The time to live (in ms) for the entryresultHandler
- the result handler will be passed the previous value
-
replace
public void replace(K k, V v, long ttl)
Replace the entry only if it is currently mapped to some value- Parameters:
k
- the keyv
- the new valuettl
- The time to live (in ms) for the entry
-
rxReplace
public io.reactivex.Maybe<V> rxReplace(K k, V v, long ttl)
Replace the entry only if it is currently mapped to some value- Parameters:
k
- the keyv
- the new valuettl
- The time to live (in ms) for the entry- Returns:
-
replaceIfPresent
public void replaceIfPresent(K k, V oldValue, V newValue, Handler<AsyncResult<Boolean>> resultHandler)
Replace the entry only if it is currently mapped to a specific value- Parameters:
k
- the keyoldValue
- the existing valuenewValue
- the new valueresultHandler
- the result handler
-
replaceIfPresent
public void replaceIfPresent(K k, V oldValue, V newValue)
Replace the entry only if it is currently mapped to a specific value- Parameters:
k
- the keyoldValue
- the existing valuenewValue
- the new value
-
rxReplaceIfPresent
public io.reactivex.Single<Boolean> rxReplaceIfPresent(K k, V oldValue, V newValue)
Replace the entry only if it is currently mapped to a specific value- Parameters:
k
- the keyoldValue
- the existing valuenewValue
- the new value- Returns:
-
replaceIfPresent
public void replaceIfPresent(K k, V oldValue, V newValue, long ttl, Handler<AsyncResult<Boolean>> resultHandler)
Replace the entry only if it is currently mapped to a specific value- Parameters:
k
- the keyoldValue
- the existing valuenewValue
- the new valuettl
- The time to live (in ms) for the entryresultHandler
- the result handler
-
replaceIfPresent
public void replaceIfPresent(K k, V oldValue, V newValue, long ttl)
Replace the entry only if it is currently mapped to a specific value- Parameters:
k
- the keyoldValue
- the existing valuenewValue
- the new valuettl
- The time to live (in ms) for the entry
-
rxReplaceIfPresent
public io.reactivex.Single<Boolean> rxReplaceIfPresent(K k, V oldValue, V newValue, long ttl)
Replace the entry only if it is currently mapped to a specific value- Parameters:
k
- the keyoldValue
- the existing valuenewValue
- the new valuettl
- The time to live (in ms) for the entry- Returns:
-
clear
public void clear(Handler<AsyncResult<Void>> resultHandler)
Clear all entries in the map- Parameters:
resultHandler
- called on completion
-
clear
public void clear()
Clear all entries in the map
-
rxClear
public io.reactivex.Completable rxClear()
Clear all entries in the map- Returns:
-
size
public void size(Handler<AsyncResult<Integer>> resultHandler)
Provide the number of entries in the map- Parameters:
resultHandler
- handler which will receive the number of entries
-
size
public void size()
Provide the number of entries in the map
-
rxSize
public io.reactivex.Single<Integer> rxSize()
Provide the number of entries in the map- Returns:
-
keys
public void keys(Handler<AsyncResult<Set<K>>> resultHandler)
Get the keys of the map, asynchronously.Use this method with care as the map may contain a large number of keys, which may not fit entirely in memory of a single node. In this case, the invocation will result in an
OutOfMemoryError
.- Parameters:
resultHandler
- invoked when the operation completes
-
keys
public void keys()
Get the keys of the map, asynchronously.Use this method with care as the map may contain a large number of keys, which may not fit entirely in memory of a single node. In this case, the invocation will result in an
OutOfMemoryError
.
-
rxKeys
public io.reactivex.Single<Set<K>> rxKeys()
Get the keys of the map, asynchronously.Use this method with care as the map may contain a large number of keys, which may not fit entirely in memory of a single node. In this case, the invocation will result in an
OutOfMemoryError
.- Returns:
-
values
public void values(Handler<AsyncResult<List<V>>> resultHandler)
Get the values of the map, asynchronously.Use this method with care as the map may contain a large number of values, which may not fit entirely in memory of a single node. In this case, the invocation will result in an
OutOfMemoryError
.- Parameters:
resultHandler
- invoked when the operation completes
-
values
public void values()
Get the values of the map, asynchronously.Use this method with care as the map may contain a large number of values, which may not fit entirely in memory of a single node. In this case, the invocation will result in an
OutOfMemoryError
.
-
rxValues
public io.reactivex.Single<List<V>> rxValues()
Get the values of the map, asynchronously.Use this method with care as the map may contain a large number of values, which may not fit entirely in memory of a single node. In this case, the invocation will result in an
OutOfMemoryError
.- Returns:
-
-