Java EnumMap hashCode() 方法

2024年11月8日 | 2 分钟阅读

Java EnumMap 类的 hashCode() 方法用于获取 EnumMap 的哈希码值。此方法返回一个整数,其值是映射中每个条目的哈希码的总和。

语法

参数

不适用

返回值

此方法返回此映射的哈希码值。

Exception

不适用

示例 1

输出

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

示例 2

输出

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