K
- the type of the cache entry keysV
- the type of the cache entry values
public interface AsyncNamedCache<K,V>
NamedCache
.Modifier and Type | Method and Description |
---|---|
<R> CompletableFuture<R> |
aggregate(Collection<? extends K> collKeys, InvocableMap.EntryAggregator<? super K,? super V,R> aggregator)
Perform an aggregating operation asynchronously against the entries specified by the passed keys.
|
<R> CompletableFuture<R> |
aggregate(Filter filter, InvocableMap.EntryAggregator<? super K,? super V,R> aggregator)
Perform an aggregating operation asynchronously against the set of entries that are selected by the given Filter.
|
default <R> CompletableFuture<R> |
aggregate(InvocableMap.EntryAggregator<? super K,? super V,R> aggregator)
Perform an aggregating operation asynchronously against all the entries.
|
default CompletableFuture<V> |
compute(K key, Remote.BiFunction<? super K,? super V,? extends V> remappingFunction)
Compute a new mapping for the specified key and its current value.
|
default CompletableFuture<V> |
computeIfAbsent(K key, Remote.Function<? super K,? extends V> mappingFunction)
Compute the value using the given mapping function and enter it into this map (unless
null ), if the specified key is not already associated with a value (or is mapped to null ). |
default CompletableFuture<V> |
computeIfPresent(K key, Remote.BiFunction<? super K,? super V,? extends V> remappingFunction)
Compute a new mapping given the key and its current mapped value, if the value for the specified key is present and non-null.
|
default CompletableFuture<Set<Map.Entry<K,V>>> |
entrySet()
Return a set view of all the entries contained in this map.
|
default CompletableFuture<Void> |
entrySet(BiConsumer<? super K,? super V> callback)
Stream all the entries contained in this map to the provided callback.
|
default CompletableFuture<Void> |
entrySet(Consumer<? super Map.Entry<? extends K,? extends V>> callback)
Stream all the entries contained in this map to the provided callback.
|
default CompletableFuture<Set<Map.Entry<K,V>>> |
entrySet(Filter filter)
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter.
|
default CompletableFuture<Void> |
entrySet(Filter filter, BiConsumer<? super K,? super V> callback)
Stream the entries that satisfy the specified filter to the provided callback.
|
default CompletableFuture<Set<Map.Entry<K,V>>> |
entrySet(Filter filter, Comparator comparator)
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter.
|
default CompletableFuture<Void> |
entrySet(Filter filter, Consumer<? super Map.Entry<? extends K,? extends V>> callback)
Stream the entries that satisfy the specified filter to the provided callback.
|
default CompletableFuture<V> |
get(K key)
Returns the value to which the specified key is mapped, or
null if this map contains no mapping for the key. |
default CompletableFuture<Map<K,V>> |
getAll(Collection<? extends K> colKeys)
Get all the specified keys, if they are in the cache.
|
default CompletableFuture<Void> |
getAll(Collection<? extends K> colKeys, BiConsumer<? super K,? super V> callback)
Stream the entries associated with the specified keys to the provided callback.
|
default CompletableFuture<Void> |
getAll(Collection<? extends K> colKeys, Consumer<? super Map.Entry<? extends K,? extends V>> callback)
Stream the entries associated with the specified keys to the provided callback.
|
default CompletableFuture<Map<K,V>> |
getAll(Filter filter)
Get all the entries that satisfy the specified filter.
|
default CompletableFuture<V> |
getOrDefault(K key, V valueDefault)
Returns the value to which the specified key is mapped, or
valueDefault if this map contains no mapping for the key. |
<R> CompletableFuture<R> |
invoke(K key, InvocableMap.EntryProcessor<K,V,R> processor)
Invoke the passed EntryProcessor against the Entry specified by the passed key asynchronously, returning a
CompletableFuture that can be used to obtain the result of the invocation. |
<R> CompletableFuture<Map<K,R>> |
invokeAll(Collection<? extends K> collKeys, InvocableMap.EntryProcessor<K,V,R> processor)
Invoke the passed EntryProcessor against the entries specified by the passed keys asynchronously, returning a
CompletableFuture that can be used to obtain the result of the invocation for each entry. |
default <R> CompletableFuture<Void> |
invokeAll(Collection<? extends K> collKeys, InvocableMap.EntryProcessor<K,V,R> processor, BiConsumer<? super K,? super R> callback)
Invoke the passed EntryProcessor against the entries specified by the passed keys asynchronously, returning a
CompletableFuture that can be used to determine if the operation completed successfully. |
<R> CompletableFuture<Void> |
invokeAll(Collection<? extends K> collKeys, InvocableMap.EntryProcessor<K,V,R> processor, Consumer<? super Map.Entry<? extends K,? extends R>> callback)
Invoke the passed EntryProcessor against the entries specified by the passed keys asynchronously, returning a
CompletableFuture that can be used to determine if the operation completed successfully. |
<R> CompletableFuture<Map<K,R>> |
invokeAll(Filter filter, InvocableMap.EntryProcessor<K,V,R> processor)
Invoke the passed EntryProcessor against the set of entries that are selected by the given Filter asynchronously, returning a
CompletableFuture that can be used to obtain the result of the invocation for each entry. |
default <R> CompletableFuture<Void> |
invokeAll(Filter filter, InvocableMap.EntryProcessor<K,V,R> processor, BiConsumer<? super K,? super R> callback)
Invoke the passed EntryProcessor against the set of entries that are selected by the given Filter asynchronously, returning a
CompletableFuture that can be used to determine if the operation completed successfully. |
<R> CompletableFuture<Void> |
invokeAll(Filter filter, InvocableMap.EntryProcessor<K,V,R> processor, Consumer<? super Map.Entry<? extends K,? extends R>> callback)
Invoke the passed EntryProcessor against the set of entries that are selected by the given Filter asynchronously, returning a
CompletableFuture that can be used to determine if the operation completed successfully. |
default <R> CompletableFuture<Map<K,R>> |
invokeAll(InvocableMap.EntryProcessor<K,V,R> processor)
Invoke the passed EntryProcessor against all the entries asynchronously, returning a
CompletableFuture that can be used to obtain the result of the invocation for each entry. |
default <R> CompletableFuture<Void> |
invokeAll(InvocableMap.EntryProcessor<K,V,R> processor, BiConsumer<? super K,? super R> callback)
Invoke the passed EntryProcessor against all the entries asynchronously, returning a
CompletableFuture that can be used to determine if the operation completed successfully. |
default <R> CompletableFuture<Void> |
invokeAll(InvocableMap.EntryProcessor<K,V,R> processor, Consumer<? super Map.Entry<? extends K,? extends R>> callback)
Invoke the passed EntryProcessor against all the entries asynchronously, returning a
CompletableFuture that can be used to determine if the operation completed successfully. |
default CompletableFuture<Set<K>> |
keySet()
Return a set view of all the keys contained in this map.
|
default CompletableFuture<Void> |
keySet(Consumer<? super K> callback)
Stream the keys of all the entries contained in this map to the provided callback.
|
default CompletableFuture<Set<K>> |
keySet(Filter filter)
Return a set view of the keys contained in this map for entries that satisfy the criteria expressed by the filter.
|
default CompletableFuture<Void> |
keySet(Filter filter, Consumer<? super K> callback)
Stream the keys for the entries that satisfy the specified filter to the provided callback.
|
default CompletableFuture<V> |
merge(K key, V value, Remote.BiFunction<? super V,? super V,? extends V> remappingFunction)
If the specified key is not already associated with a value or is associated with null, associates it with the given non-null value.
|
default CompletableFuture<Void> |
put(K key, V value)
Associates the specified value with the specified key in this cache.
|
default CompletableFuture<Void> |
put(K key, V value, long cMillis)
Associates the specified value with the specified key in this cache.
|
default CompletableFuture<Void> |
putAll(Map<? extends K,? extends V> map)
Copies all of the mappings from the specified map to this map.
|
default CompletableFuture<V> |
putIfAbsent(K key, V value)
If the specified key is not already associated with a value (or is mapped to
null ) associates it with the given value and returns null , else returns the current value. |
default CompletableFuture<V> |
remove(K key)
Removes the mapping for a key from this map if it is present.
|
default CompletableFuture<Boolean> |
remove(K key, V value)
Removes the entry for the specified key only if it is currently mapped to the specified value.
|
default CompletableFuture<Void> |
removeAll(Collection<? extends K> colKeys)
Removes all of the mappings from the specified keys from this map, if they are present in the cache.
|
default CompletableFuture<Void> |
removeAll(Filter filter)
Removes all of the mappings that satisfy the specified filter from this map.
|
default CompletableFuture<V> |
replace(K key, V value)
Replaces the entry for the specified key only if it is currently mapped to some value.
|
default CompletableFuture<Boolean> |
replace(K key, V oldValue, V newValue)
Replaces the entry for the specified key only if currently mapped to the specified value.
|
default CompletableFuture<Map<K,Void>> |
replaceAll(Collection<? extends K> collKeys, Remote.BiFunction<? super K,? super V,? extends V> function)
Replace each entry's value with the result of invoking the given function on that entry until all entries for the specified key set have been processed or the function throws an exception.
|
default CompletableFuture<Map<K,Void>> |
replaceAll(Filter filter, Remote.BiFunction<? super K,? super V,? extends V> function)
Replace each entry's value with the result of invoking the given function on that entry until all entries selected by the specified filter have been processed or the function throws an exception.
|
default CompletableFuture<Map<K,Void>> |
replaceAll(Remote.BiFunction<? super K,? super V,? extends V> function)
Replace each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception.
|
default CompletableFuture<Collection<V>> |
values()
Return a collection of all the values contained in this map.
|
default CompletableFuture<Void> |
values(Consumer<? super V> callback)
Stream the values of all the entries contained in this map to the provided callback.
|
default CompletableFuture<Collection<V>> |
values(Filter filter)
Return a collection of the values contained in this map that satisfy the criteria expressed by the filter.
|
default CompletableFuture<Collection<V>> |
values(Filter filter, Comparator<? super V> comparator)
Return a collection of the values contained in this map that satisfy the criteria expressed by the filter.
|
default CompletableFuture<Void> |
values(Filter filter, Consumer<? super V> callback)
Stream the values for the entries that satisfy the specified filter to the provided callback.
|
default CompletableFuture<V> get(K key)
null
if this map contains no mapping for the key.key
- the key whose associated value is to be returnedCompletableFuture
for the value to which the specified key is mappeddefault CompletableFuture<Map<K,V>> getAll(Collection<? extends K> colKeys)
colKeys
- a collection of keys that may be in the named cacheCompletableFuture
for a Map of keys to values for the specified keys passed in colKeysdefault CompletableFuture<Map<K,V>> getAll(Filter filter)
filter
- a Filter that determines the set of entries to returnCompletableFuture
for a Map of keys to values for the specified filterdefault CompletableFuture<Void> getAll(Collection<? extends K> colKeys, BiConsumer<? super K,? super V> callback)
colKeys
- a collection of keys that may be in the named cachecallback
- a consumer of results as they become availableCompletableFuture
that can be used to determine whether the operation completeddefault CompletableFuture<Void> getAll(Collection<? extends K> colKeys, Consumer<? super Map.Entry<? extends K,? extends V>> callback)
colKeys
- a collection of keys that may be in the named cachecallback
- a consumer of results as they become availableCompletableFuture
that can be used to determine whether the operation completeddefault CompletableFuture<Void> put(K key, V value)
Invoking this method is equivalent to the following call:
put(oKey, oValue, CacheMap.EXPIRY_DEFAULT);
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keyCompletableFuture
default CompletableFuture<Void> put(K key, V value, long cMillis)
put(Object oKey, Object oValue)
method allows the caller to specify an expiry (or "time to live") for the cache entry.key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keycMillis
- the number of milliseconds until the cache entry will expire, also referred to as the entry's "time to live"; pass CacheMap.EXPIRY_DEFAULT
to use the cache's default time-to-live setting; pass CacheMap.EXPIRY_NEVER
to indicate that the cache entry should never expire; this milliseconds value is not a date/time value, such as is returned from System.currentTimeMillis()CompletableFuture
default CompletableFuture<Void> putAll(Map<? extends K,? extends V> map)
map
- mappings to be added to this mapCompletableFuture
default CompletableFuture<V> remove(K key)
key
- key whose mapping is to be removed from the mapCompletableFuture
for the previous value associated with the keydefault CompletableFuture<Void> removeAll(Collection<? extends K> colKeys)
colKeys
- a collection of keys that may be in the named cacheCompletableFuture
default CompletableFuture<Void> removeAll(Filter filter)
filter
- a Filter that determines the set of entries to removeCompletableFuture
default CompletableFuture<Set<K>> keySet()
default CompletableFuture<Set<K>> keySet(Filter filter)
filter
- the Filter object representing the criteria that the entries of this map should satisfydefault CompletableFuture<Void> keySet(Consumer<? super K> callback)
callback
- a consumer of results as they become availableCompletableFuture
that can be used to determine whether the operation completeddefault CompletableFuture<Void> keySet(Filter filter, Consumer<? super K> callback)
filter
- the Filter object representing the criteria that the entries of this map should satisfycallback
- a consumer of results as they become availableCompletableFuture
that can be used to determine whether the operation completeddefault CompletableFuture<Set<Map.Entry<K,V>>> entrySet()
Map.Entry
.default CompletableFuture<Set<Map.Entry<K,V>>> entrySet(Filter filter)
Map.Entry
.filter
- the Filter object representing the criteria that the entries of this map should satisfydefault CompletableFuture<Set<Map.Entry<K,V>>> entrySet(Filter filter, Comparator comparator)
Map.Entry
. It is further guaranteed that its iterator will traverse the set in such a way that the entry values come up in ascending order, sorted by the specified Comparator or according to the natural ordering (see Comparable
).filter
- the Filter object representing the criteria that the entries of this map should satisfycomparator
- the Comparator object which imposes an ordering on entries in the resulting set; or null if the entries' values natural ordering should be useddefault CompletableFuture<Void> entrySet(BiConsumer<? super K,? super V> callback)
callback
- a consumer of results as they become availableCompletableFuture
that can be used to determine whether the operation completeddefault CompletableFuture<Void> entrySet(Consumer<? super Map.Entry<? extends K,? extends V>> callback)
callback
- a consumer of results as they become availableCompletableFuture
that can be used to determine whether the operation completeddefault CompletableFuture<Void> entrySet(Filter filter, BiConsumer<? super K,? super V> callback)
filter
- the Filter object representing the criteria that the entries of this map should satisfycallback
- a consumer of results as they become availableCompletableFuture
that can be used to determine whether the operation completeddefault CompletableFuture<Void> entrySet(Filter filter, Consumer<? super Map.Entry<? extends K,? extends V>> callback)
filter
- the Filter object representing the criteria that the entries of this map should satisfycallback
- a consumer of results as they become availableCompletableFuture
that can be used to determine whether the operation completeddefault CompletableFuture<Collection<V>> values()
default CompletableFuture<Collection<V>> values(Filter filter)
filter
- the Filter object representing the criteria that the entries of this map should satisfydefault CompletableFuture<Collection<V>> values(Filter filter, Comparator<? super V> comparator)
filter
- the Filter object representing the criteria that the entries of this map should satisfycomparator
- the Comparator object which imposes an ordering on entries in the resulting set; or null if the entries' values natural ordering should be useddefault CompletableFuture<Void> values(Consumer<? super V> callback)
callback
- a consumer of results as they become availableCompletableFuture
that can be used to determine whether the operation completeddefault CompletableFuture<Void> values(Filter filter, Consumer<? super V> callback)
filter
- the Filter object representing the criteria that the entries of this map should satisfycallback
- a consumer of results as they become availableCompletableFuture
that can be used to determine whether the operation completed<R> CompletableFuture<R> invoke(K key, InvocableMap.EntryProcessor<K,V,R> processor)
CompletableFuture
that can be used to obtain the result of the invocation.R
- the type of value returned by the EntryProcessorkey
- the key to process; it is not required to exist within the Mapprocessor
- the EntryProcessor to use to process the specified keyCompletableFuture
that can be used to obtain the result of the invocationdefault <R> CompletableFuture<Map<K,R>> invokeAll(InvocableMap.EntryProcessor<K,V,R> processor)
CompletableFuture
that can be used to obtain the result of the invocation for each entry.R
- the type of value returned by the EntryProcessorprocessor
- the EntryProcessor to use to process the specified keysCompletableFuture
that can be used to obtain the result of the invocation for each entry<R> CompletableFuture<Map<K,R>> invokeAll(Collection<? extends K> collKeys, InvocableMap.EntryProcessor<K,V,R> processor)
CompletableFuture
that can be used to obtain the result of the invocation for each entry.R
- the type of value returned by the EntryProcessorcollKeys
- the keys to process; these keys are not required to exist within the Mapprocessor
- the EntryProcessor to use to process the specified keysCompletableFuture
that can be used to obtain the result of the invocation for each entry<R> CompletableFuture<Map<K,R>> invokeAll(Filter filter, InvocableMap.EntryProcessor<K,V,R> processor)
CompletableFuture
that can be used to obtain the result of the invocation for each entry.R
- the type of value returned by the EntryProcessorfilter
- a Filter that results in the set of keys to be processedprocessor
- the EntryProcessor to use to process the specified keysCompletableFuture
that can be used to obtain the result of the invocation for each entrydefault <R> CompletableFuture<Void> invokeAll(InvocableMap.EntryProcessor<K,V,R> processor, Consumer<? super Map.Entry<? extends K,? extends R>> callback)
CompletableFuture
that can be used to determine if the operation completed successfully.
Instead of collecting and returning the complete result, this method will stream partial results of the processor execution to the specified partial result callback, which allows for a much lower memory overhead.
R
- the type of value returned by the EntryProcessorprocessor
- the EntryProcessor to use to process the specified keyscallback
- a user-defined callback that will be called for each partial resultCompletableFuture
that can be used to determine if the operation completed successfullydefault <R> CompletableFuture<Void> invokeAll(InvocableMap.EntryProcessor<K,V,R> processor, BiConsumer<? super K,? super R> callback)
CompletableFuture
that can be used to determine if the operation completed successfully.
Instead of collecting and returning the complete result, this method will stream partial results of the processor execution to the specified partial result callback, which allows for a much lower memory overhead.
R
- the type of value returned by the EntryProcessorprocessor
- the EntryProcessor to use to process the specified keyscallback
- a user-defined callback that will be called for each partial resultCompletableFuture
that can be used to determine if the operation completed successfully<R> CompletableFuture<Void> invokeAll(Collection<? extends K> collKeys, InvocableMap.EntryProcessor<K,V,R> processor, Consumer<? super Map.Entry<? extends K,? extends R>> callback)
CompletableFuture
that can be used to determine if the operation completed successfully.
Instead of collecting and returning the complete result, this method will stream partial results of the processor execution to the specified partial result callback, which allows for a much lower memory overhead.
R
- the type of value returned by the EntryProcessorcollKeys
- the keys to process; these keys are not required to exist within the Mapprocessor
- the EntryProcessor to use to process the specified keyscallback
- a user-defined callback that will be called for each partial resultCompletableFuture
that can be used to determine if the operation completed successfullydefault <R> CompletableFuture<Void> invokeAll(Collection<? extends K> collKeys, InvocableMap.EntryProcessor<K,V,R> processor, BiConsumer<? super K,? super R> callback)
CompletableFuture
that can be used to determine if the operation completed successfully.
Instead of collecting and returning the complete result, this method will stream partial results of the processor execution to the specified partial result callback, which allows for a much lower memory overhead.
R
- the type of value returned by the EntryProcessorcollKeys
- the keys to process; these keys are not required to exist within the Mapprocessor
- the EntryProcessor to use to process the specified keyscallback
- a user-defined callback that will be called for each partial resultCompletableFuture
that can be used to determine if the operation completed successfully<R> CompletableFuture<Void> invokeAll(Filter filter, InvocableMap.EntryProcessor<K,V,R> processor, Consumer<? super Map.Entry<? extends K,? extends R>> callback)
CompletableFuture
that can be used to determine if the operation completed successfully.
Instead of collecting and returning the complete result, this method will stream partial results of the processor execution to the specified partial result callback, which allows for a much lower memory overhead.
R
- the type of value returned by the EntryProcessorfilter
- a Filter that results in the set of keys to be processedprocessor
- the EntryProcessor to use to process the specified keyscallback
- a user-defined callback that will be called for each partial resultCompletableFuture
that can be used to determine if the operation completed successfullydefault <R> CompletableFuture<Void> invokeAll(Filter filter, InvocableMap.EntryProcessor<K,V,R> processor, BiConsumer<? super K,? super R> callback)
CompletableFuture
that can be used to determine if the operation completed successfully.
Instead of collecting and returning the complete result, this method will stream partial results of the processor execution to the specified partial result callback, which allows for a much lower memory overhead.
R
- the type of value returned by the EntryProcessorfilter
- a Filter that results in the set of keys to be processedprocessor
- the EntryProcessor to use to process the specified keyscallback
- a user-defined callback that will be called for each partial resultCompletableFuture
that can be used to determine if the operation completed successfullydefault <R> CompletableFuture<R> aggregate(InvocableMap.EntryAggregator<? super K,? super V,R> aggregator)
R
- the type of value returned by the EntryAggregatoraggregator
- the EntryAggregator that is used to aggregate across the specified entries of this MapCompletableFuture
that can be used to obtain the result of the aggregation<R> CompletableFuture<R> aggregate(Collection<? extends K> collKeys, InvocableMap.EntryAggregator<? super K,? super V,R> aggregator)
R
- the type of value returned by the EntryAggregatorcollKeys
- the Collection of keys that specify the entries within this Map to aggregate acrossaggregator
- the EntryAggregator that is used to aggregate across the specified entries of this MapCompletableFuture
that can be used to obtain the result of the aggregation<R> CompletableFuture<R> aggregate(Filter filter, InvocableMap.EntryAggregator<? super K,? super V,R> aggregator)
R
- the type of value returned by the EntryAggregatorfilter
- the Filter that is used to select entries within this Map to aggregate acrossaggregator
- the EntryAggregator that is used to aggregate across the selected entries of this MapCompletableFuture
that can be used to obtain the result of the aggregationdefault CompletableFuture<V> getOrDefault(K key, V valueDefault)
valueDefault
if this map contains no mapping for the key.key
- the key whose associated value is to be returnedvalueDefault
- the default mapping of the keyvalueDefault
if this map contains no mapping for the keydefault CompletableFuture<V> putIfAbsent(K key, V value)
null
) associates it with the given value and returns null
, else returns the current value.key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keynull
if there was no mapping for the key. (A null
return can also indicate that the map previously associated null
with the key, if the implementation supports null values.)default CompletableFuture<Boolean> remove(K key, V value)
key
- key with which the specified value is associatedvalue
- value expected to be associated with the specified keytrue
if the value was removeddefault CompletableFuture<V> replace(K key, V value)
key
- key with which the specified value is associatedvalue
- value to be associated with the specified keynull
if there was no mapping for the key. (A null
return can also indicate that the map previously associated null
with the key, if the implementation supports null values.)default CompletableFuture<Boolean> replace(K key, V oldValue, V newValue)
key
- key with which the specified value is associatedoldValue
- value expected to be associated with the specified keynewValue
- value to be associated with the specified keytrue
if the value was replaceddefault CompletableFuture<V> computeIfAbsent(K key, Remote.Function<? super K,? extends V> mappingFunction)
null
), if the specified key is not already associated with a value (or is mapped to null
).
If the mapping function returns null
no mapping is recorded. If the function itself throws an (unchecked) exception, the exception is rethrown, and no mapping is recorded.
The most common usage is to construct a new object serving as an initial mapped value or memoized result, as in:
map.computeIfAbsent(key, k -> new Value(f(k)));
Or to implement a multi-value map, Map<K, Collection<V>>
, supporting multiple values per key:
map.computeIfAbsent(key, k -> new HashSet<V>()).add(v);
Note that the previous example will not work as expected if this method is called on a distributed map, as the <c>add</c> method will be called on the client-side copy of the collection stored on the server.key
- key with which the specified value is to be associatedmappingFunction
- the function to compute a valuedefault CompletableFuture<V> computeIfPresent(K key, Remote.BiFunction<? super K,? super V,? extends V> remappingFunction)
If the function returns null
, the mapping is removed. If the function itself throws an (unchecked) exception, the exception is rethrown, and the current mapping is left unchanged.
key
- the key with which the specified value is to be associatedremappingFunction
- the function to compute a valuedefault CompletableFuture<V> compute(K key, Remote.BiFunction<? super K,? super V,? extends V> remappingFunction)
If the function returns null
, the mapping is removed (or remains absent if initially absent). If the function itself throws an (unchecked) exception, the exception is rethrown, and the current mapping is left unchanged.
key
- the key with which the computed value is to be associatedremappingFunction
- the function to compute a valuedefault CompletableFuture<V> merge(K key, V value, Remote.BiFunction<? super V,? super V,? extends V> remappingFunction)
null
.
This method may be of use when combining multiple mapped values for a key. For example, to either create or append a String msg
to a value mapping:
map.merge(key, msg, String::concat)
If the function returns null
the mapping is removed. If the function itself throws an (unchecked) exception, the exception is rethrown, and the current mapping is left unchanged.key
- key with which the resulting value is to be associatedvalue
- the non-null value to be merged with the existing value associated with the key or, if no existing value or a null value is associated with the key, to be associated with the keyremappingFunction
- the function to recompute a value if presentdefault CompletableFuture<Map<K,Void>> replaceAll(Remote.BiFunction<? super K,? super V,? extends V> function)
function
- the function to apply to each entrydefault CompletableFuture<Map<K,Void>> replaceAll(Collection<? extends K> collKeys, Remote.BiFunction<? super K,? super V,? extends V> function)
collKeys
- the keys to process; these keys are not required to exist within the Mapfunction
- the function to apply to each entrydefault CompletableFuture<Map<K,Void>> replaceAll(Filter filter, Remote.BiFunction<? super K,? super V,? extends V> function)
filter
- the filter that should be used to select entriesfunction
- the function to apply to each entry