ConcurrentHashMap.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")]
public virtual 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")>]
override this.Remove : Java.Lang.Object * Java.Lang.Object -> bool
Parameters
- key
- Object
the key that needs to be removed
- value
- Object
value expected to be associated with the specified key
Returns
true if the value was removed
Implements
- Attributes
Exceptions
if the specified key is null
Remarks
Removes the entry for a key only if currently mapped to a given value.
This is equivalent to, for this map:
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 reference for java.util.concurrent.ConcurrentHashMap.remove.
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.