IConcurrentMap.Remove(Object, Object) Method

Definition

Removes the entry for a key only if currently mapped to a given value.

[Android.Runtime.Register("remove", "(Ljava/lang/Object;Ljava/lang/Object;)Z", "GetRemove_Ljava_lang_Object_Ljava_lang_Object_Handler:Java.Util.Concurrent.IConcurrentMapInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool Remove (Java.Lang.Object? key, Java.Lang.Object? value);
[<Android.Runtime.Register("remove", "(Ljava/lang/Object;Ljava/lang/Object;)Z", "GetRemove_Ljava_lang_Object_Ljava_lang_Object_Handler:Java.Util.Concurrent.IConcurrentMapInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Remove : Java.Lang.Object * Java.Lang.Object -> bool

Parameters

key
Object

key with which the specified value is associated

value
Object

value expected to be associated with the specified key

Returns

true if the value was removed

Implements

Attributes

Exceptions

if the remove operation is not supported by this map

if the key or value is of an inappropriate type for this map (optional)

if the specified key or value is null, and this map does not permit null keys or values (optional)

Remarks

Removes the entry for a key only if currently mapped to a given value. This is equivalent to, for this map:

{@code
            if (map.containsKey(key)
                && Objects.equals(map.get(key), value)) {
              map.remove(key);
              return true;
            } else {
              return false;
            }}

except that the action is performed atomically.

Java documentation for java.util.concurrent.ConcurrentMap.remove(java.lang.Object, java.lang.Object).

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