Aracılığıyla paylaş


Collections.SingletonMap(Object, Object) Method

Definition

Returns an immutable map, mapping only the specified key to the specified value.

[Android.Runtime.Register("singletonMap", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "K", "V" })]
public static System.Collections.IDictionary SingletonMap (Java.Lang.Object? key, Java.Lang.Object? value);
[<Android.Runtime.Register("singletonMap", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "K", "V" })>]
static member SingletonMap : Java.Lang.Object * Java.Lang.Object -> System.Collections.IDictionary

Parameters

key
Object

the sole key to be stored in the returned map.

value
Object

the value to which the returned map maps key.

Returns

an immutable map containing only the specified key-value mapping.

Attributes

Remarks

Returns an immutable map, mapping only the specified key to the specified value. The returned map is serializable.

Added in 1.3.

Java documentation for java.util.Collections.singletonMap(K, 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