Share via


ConcurrentHashMap.GetOrDefault(Object, Object) Method

Definition

Returns the value to which the specified key is mapped, or the given default value if this map contains no mapping for the key.

[Android.Runtime.Register("getOrDefault", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "GetGetOrDefault_Ljava_lang_Object_Ljava_lang_Object_Handler", ApiSince=24)]
public virtual Java.Lang.Object? GetOrDefault (Java.Lang.Object key, Java.Lang.Object? defaultValue);
[<Android.Runtime.Register("getOrDefault", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "GetGetOrDefault_Ljava_lang_Object_Ljava_lang_Object_Handler", ApiSince=24)>]
abstract member GetOrDefault : Java.Lang.Object * Java.Lang.Object -> Java.Lang.Object
override this.GetOrDefault : Java.Lang.Object * Java.Lang.Object -> Java.Lang.Object

Parameters

key
Object

the key whose associated value is to be returned

defaultValue
Object

the value to return if this map contains no mapping for the given key

Returns

the mapping for the key, if present; else the default value

Implements

Attributes

Remarks

Returns the value to which the specified key is mapped, or the given default value if this map contains no mapping for the key.

Java documentation for java.util.concurrent.ConcurrentHashMap.getOrDefault(java.lang.Object, V).

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