Java IdentityHashMap containsKey() method

7 Jan 2025 | 2 min read

The containsKey(Object key) method of the Java IdentityHashMap class is used to check whether the calling IdentityHashMap contains the specified key.

Syntax

Parameters

Key - The possible key which is to be checked in the IdentityHashMap.

Return

True, if the specified key is a key in the calling IdentityHashMap.

Example 1

Output:

 true false false true 

Example 2

Output:

 false true true false