Language

SparseBooleanArray.Compute(Int32, IIntBinaryOperator) Method

Definition

Attempts to compute a new mapped value for the specified key based on its current mapped value (or false if there is no current mapping).

[Android.Runtime.Register("compute", "(ILjava/util/function/IntBinaryOperator;)Z", "GetCompute_ILjava_util_function_IntBinaryOperator_Handler", ApiSince=37)]
public virtual bool Compute(int key, Java.Util.Functions.IIntBinaryOperator function);
[<Android.Runtime.Register("compute", "(ILjava/util/function/IntBinaryOperator;)Z", "GetCompute_ILjava_util_function_IntBinaryOperator_Handler", ApiSince=37)>]
abstract member Compute : int * Java.Util.Functions.IIntBinaryOperator -> bool
override this.Compute : int * Java.Util.Functions.IIntBinaryOperator -> bool

Parameters

key
Int32

The key to compute the value for.

function
IIntBinaryOperator

The function to compute the new value. For the second argument that represents the current mapped value, 0 is used for false and 1 for true. The returned value will be converted to a boolean similarly, 0 for false and true otherwise.

Returns

The new mapped value.

Attributes

Remarks

Attempts to compute a new mapped value for the specified key based on its current mapped value (or false if there is no current mapping). The boolean values passed to and returned from the function are converted to integers (0 for false and true otherwise) to avoid type boxing.

Android reference for android.util.SparseBooleanArray.compute.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to