Freigeben über


Dictionary.Put(Object, Object) Method

Definition

Maps the specified key to the specified value in this dictionary.

[Android.Runtime.Register("put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "GetPut_Ljava_lang_Object_Ljava_lang_Object_Handler")]
public abstract Java.Lang.Object? Put (Java.Lang.Object? key, Java.Lang.Object? value);
[<Android.Runtime.Register("put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "GetPut_Ljava_lang_Object_Ljava_lang_Object_Handler")>]
abstract member Put : Java.Lang.Object * Java.Lang.Object -> Java.Lang.Object

Parameters

key
Object

the hashtable key.

value
Object

the value.

Returns

the previous value to which the key was mapped in this dictionary, or null if the key did not have a previous mapping.

Attributes

Remarks

Maps the specified key to the specified value in this dictionary. Neither the key nor the value can be null.

If this dictionary already contains an entry for the specified key, the value already in this dictionary for that key is returned, after modifying the entry to contain the new element.

If this dictionary does not already have an entry for the specified key, an entry is created for the specified key and value, and null is returned.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Java documentation for java.util.Dictionary.put(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