IdentityHashMap 与 HashMap 的区别时间:2025-04-14 14:07:07 IdentityHashMap 中的 key 允许重复 IdentityHashMap 使用的是 == 比较 key 的值(比较内存地址),而 HashMap 使用的是 equals()(比较存储值) IdentityHashMap 使用的是 System.identityHashCode(object) 查找位置,HashMap 使用的是 hashCode() 查找位置 IdentityHashMap 理论上来说速度要比 HashMap 快一点