Java IdentityHashMap put() method

The put(K key, V value) method of the Java IdentityHashMap class is used to link the specified key with a specified value in the calling IdentityHashMap.

Syntax

Parameters

Key - The key with which the specified value is to be linked.

Value - The value which is to be linked with the specified key.

Return

The previous value associated with the key or null if there was no linkage for the specified key.

Example 1

Output:

null
null
12
null
null
4
null
null
{Java=1, the=3, language=6, programming=5, best=4, is=2}

Example 2

Output:

null
null
null
null
[1, 3, 2, 4]