public class DefaultAsyncMap<K,V> extends net.kuujo.copycat.resource.internal.AbstractResource<AsyncMap<K,V>> implements AsyncMap<K,V>
| Constructor and Description |
|---|
DefaultAsyncMap(net.kuujo.copycat.resource.internal.ResourceManager context) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> CompletableFuture<T> |
checkOpen(java.util.function.Supplier<CompletableFuture<T>> supplier)
If the map is closed, returning a failed CompletableFuture.
|
CompletableFuture<Void> |
clear()
Clears the map.
|
CompletableFuture<Void> |
close() |
CompletableFuture<V> |
compute(K key,
java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction)
Computes the value of a key in the map.
|
CompletableFuture<V> |
computeIfAbsent(K key,
java.util.function.Function<? super K,? extends V> mappingFunction)
Computes the value of a key if the key is absent from the map.
|
CompletableFuture<V> |
computeIfPresent(K key,
java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction)
Computes the value of a key if the key is present in the map.
|
CompletableFuture<Boolean> |
containsKey(Object key)
Checks whether the map contains a key.
|
CompletableFuture<Boolean> |
containsValue(Object value)
Checks whether the map contains a value.
|
CompletableFuture<Set<Map.Entry<K,V>>> |
entrySet()
Gets a set of entries in the map.
|
CompletableFuture<V> |
get(Object key)
Gets a value from the map.
|
CompletableFuture<V> |
getOrDefault(Object key,
V defaultValue)
Gets the value of a key or the given default value if the key does not exist.
|
CompletableFuture<Boolean> |
isEmpty()
Checks whether the map is empty.
|
CompletableFuture<Set<K>> |
keySet()
Gets a set of keys in the map.
|
CompletableFuture<V> |
merge(K key,
V value,
java.util.function.BiFunction<? super V,? super V,? extends V> remappingFunction)
Merges values in the map.
|
CompletableFuture<AsyncMap<K,V>> |
open() |
CompletableFuture<V> |
put(K key,
V value)
Puts a value in the map.
|
CompletableFuture<Void> |
putAll(Map<? extends K,? extends V> m)
Puts a map of values in the map.
|
CompletableFuture<V> |
putIfAbsent(K key,
V value)
Puts a value in the map if the given key does not exist.
|
CompletableFuture<V> |
remove(Object key)
Removes a value from the map.
|
CompletableFuture<Boolean> |
remove(Object key,
Object value)
Removes a key and value from the map.
|
CompletableFuture<V> |
replace(K key,
V value)
Replaces a key with the given value.
|
CompletableFuture<Boolean> |
replace(K key,
V oldValue,
V newValue)
Replaces a key and value in the map.
|
CompletableFuture<Void> |
replaceAll(java.util.function.BiFunction<? super K,? super V,? extends V> function)
Replaces values in the map.
|
CompletableFuture<Integer> |
size()
Gets the map size.
|
CompletableFuture<Collection<V>> |
values()
Gets a collection of values in the map.
|
addShutdownTask, addStartupTask, cluster, isClosed, isOpen, name, runShutdownTasks, runStartupTasks, stateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic DefaultAsyncMap(net.kuujo.copycat.resource.internal.ResourceManager context)
protected <T> CompletableFuture<T> checkOpen(java.util.function.Supplier<CompletableFuture<T>> supplier)
T - The future result type.supplier - The supplier to call if the map is open.public CompletableFuture<Integer> size()
AsyncMapProxysize in interface AsyncMapProxy<K,V>public CompletableFuture<Boolean> isEmpty()
AsyncMapProxyisEmpty in interface AsyncMapProxy<K,V>public CompletableFuture<Boolean> containsKey(Object key)
AsyncMapProxycontainsKey in interface AsyncMapProxy<K,V>key - The key to check.public CompletableFuture<Boolean> containsValue(Object value)
AsyncMapProxycontainsValue in interface AsyncMapProxy<K,V>value - The value to check.public CompletableFuture<V> get(Object key)
AsyncMapProxyget in interface AsyncMapProxy<K,V>key - The key to get.public CompletableFuture<V> put(K key, V value)
AsyncMapProxyput in interface AsyncMapProxy<K,V>key - The key to set.value - The value to set.public CompletableFuture<V> remove(Object key)
AsyncMapProxyremove in interface AsyncMapProxy<K,V>key - The key to remove.public CompletableFuture<Void> putAll(Map<? extends K,? extends V> m)
AsyncMapProxyputAll in interface AsyncMapProxy<K,V>m - The put to put.public CompletableFuture<Void> clear()
AsyncMapProxyclear in interface AsyncMapProxy<K,V>public CompletableFuture<Set<K>> keySet()
AsyncMapProxykeySet in interface AsyncMapProxy<K,V>public CompletableFuture<Collection<V>> values()
AsyncMapProxyvalues in interface AsyncMapProxy<K,V>public CompletableFuture<Set<Map.Entry<K,V>>> entrySet()
AsyncMapProxyentrySet in interface AsyncMapProxy<K,V>public CompletableFuture<V> getOrDefault(Object key, V defaultValue)
AsyncMapProxygetOrDefault in interface AsyncMapProxy<K,V>key - The key to get.defaultValue - The default value to return if the key does not exist.public CompletableFuture<Void> replaceAll(java.util.function.BiFunction<? super K,? super V,? extends V> function)
AsyncMapProxyreplaceAll in interface AsyncMapProxy<K,V>function - The serializable function with which to replace values.public CompletableFuture<V> putIfAbsent(K key, V value)
AsyncMapProxyputIfAbsent in interface AsyncMapProxy<K,V>key - The key to set.value - The value to set if the given key does not exist.public CompletableFuture<Boolean> remove(Object key, Object value)
AsyncMapProxyremove in interface AsyncMapProxy<K,V>key - The key to remove.value - The value to remove.public CompletableFuture<Boolean> replace(K key, V oldValue, V newValue)
AsyncMapProxyreplace in interface AsyncMapProxy<K,V>key - The key to replace.oldValue - The value to replace.newValue - The value with which to replace the given key and value.public CompletableFuture<V> replace(K key, V value)
AsyncMapProxyreplace in interface AsyncMapProxy<K,V>key - The key to replace.value - The value with which to replace the given key.public CompletableFuture<V> computeIfAbsent(K key, java.util.function.Function<? super K,? extends V> mappingFunction)
AsyncMapProxycomputeIfAbsent in interface AsyncMapProxy<K,V>key - The key to compute.mappingFunction - The serializable function with which to compute the value.public CompletableFuture<V> computeIfPresent(K key, java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction)
AsyncMapProxycomputeIfPresent in interface AsyncMapProxy<K,V>key - The key to compute.remappingFunction - The serializable function with which to compute the value.public CompletableFuture<V> compute(K key, java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction)
AsyncMapProxycompute in interface AsyncMapProxy<K,V>key - The key to compute.remappingFunction - The The serializable function with which to compute the value.public CompletableFuture<V> merge(K key, V value, java.util.function.BiFunction<? super V,? super V,? extends V> remappingFunction)
AsyncMapProxymerge in interface AsyncMapProxy<K,V>key - The key to merge.value - The value to merge.remappingFunction - The function with which to merge the value.public CompletableFuture<AsyncMap<K,V>> open()
public CompletableFuture<Void> close()
Copyright © 2013-2015. All Rights Reserved.