Javatpoint Logo
Javatpoint Logo

Java IdentityHashMap clear() method

The clear() method of the Java IdentityHashMap class is used to remove all the key-value pairs from the calling IdentityHashMap. The IdentityHashMap will become empty after calling this method.

Syntax

Example 1

Test it Now

Output:

is->2
best->4
Java->1
the->3
language->6
programming->5
true

Example 2

Test it Now

Output:

false
true



Help Others, Please Share

facebook twitter pinterest