Java EnumMap hashCode() method

8 Nov 2024 | 2 min read

The hashCode() method of Java EnumMap class is used to get the hashcode value of the EnumMap.This method returns an integer whose value is the sum of the hash codes of each entry in the map.

Syntax

Parameters

NA

Returns

This method returns the hash code value for this map.

Exception

NA

Example 1

Output:

Hash code value of the map: -450357866 Hash code value after clearing the map: 0 

Example 2

Output:

Hash code value of the map: -1315471824 Hash code value after clearing the map: 0