共用方式為


IMap.Get(Object) Method

Definition

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

[Android.Runtime.Register("get", "(Ljava/lang/Object;)Ljava/lang/Object;", "GetGet_Ljava_lang_Object_Handler:Java.Util.IMapInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Java.Lang.Object? Get (Java.Lang.Object? key);
[<Android.Runtime.Register("get", "(Ljava/lang/Object;)Ljava/lang/Object;", "GetGet_Ljava_lang_Object_Handler:Java.Util.IMapInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Get : Java.Lang.Object -> Java.Lang.Object

Parameters

key
Object

the key whose associated value is to be returned

Returns

the value to which the specified key is mapped, or null if this map contains no mapping for the key

Attributes

Remarks

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

More formally, if this map contains a mapping from a key k to a value v such that Objects.equals(key, k), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

If this map permits null values, then a return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The #containsKey containsKey operation may be used to distinguish these two cases.

Java documentation for java.util.Map.get(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