IConcurrentMap.Remove(Object, Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
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.