Java IdentityHashMap size() method
Java IdentityHashMap size() method
Last Updated : 17 Mar 2025
The size() method of the Java IdentityHashMap class is used to calculate the no of key-value pairs present in the calling IdentityHashMap.
Syntax
Return
An integer denoting the number of key-value pairs present in the IdentityHashMap.
Example 1
Output:
6
{Java=1, the=3, language=6, programming=5, best=4, is=2}
Example 2
Output:
Next TopicJava-identityhashmap-remove-method