Taal

TreeMap.ComputeIfPresent(Object, IBiFunction) Method

Definition

If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value.

[Android.Runtime.Register("computeIfPresent", "(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;", "GetComputeIfPresent_Ljava_lang_Object_Ljava_util_function_BiFunction_Handler", ApiSince=35)]
public virtual Java.Lang.Object? ComputeIfPresent(Java.Lang.Object? key, Java.Util.Functions.IBiFunction remappingFunction);
[<Android.Runtime.Register("computeIfPresent", "(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;", "GetComputeIfPresent_Ljava_lang_Object_Ljava_util_function_BiFunction_Handler", ApiSince=35)>]
abstract member ComputeIfPresent : Java.Lang.Object * Java.Util.Functions.IBiFunction -> Java.Lang.Object
override this.ComputeIfPresent : Java.Lang.Object * Java.Util.Functions.IBiFunction -> Java.Lang.Object

Parameters

key
Object

key with which the specified value is to be associated

remappingFunction
IBiFunction

the remapping function to compute a value

Returns

the new value associated with the specified key, or null if none

Implements

Attributes

Remarks

If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value. If the remapping function returns null, the mapping is removed. If the remapping function itself throws an (unchecked) exception, the exception is rethrown, and the current mapping is left unchanged. The remapping function should not modify this map during computation. This method will, on a best-effort basis, throw a ConcurrentModificationException if it is detected that the remapping function modifies this map during computation.

Java reference for java.util.TreeMap.computeIfPresent.

Applies to