HashMap 内部算法
定位 key 位于 table 中的位置
h = hashCode(): 0000 1111 1111 0000 0000 0000 0101 0101
h >>> 16: 0000 0000 0000 0000 0000 1111 1111 0000
hash = h ^ (h >>> 16): 0000 1111 1111 0000 0000 1111 1010 0101 hash = h ^ (h >>> 16): 0000 1111 1111 0000 0000 1111 1010 0101
table.length - 1: 0000 0000 0000 0000 0000 0000 1111 1111
(table.length - 1) & hash: 0000 0000 0000 0000 0000 0000 1010 0101扩容 table
在 OpenJDK 中的实现
在 OracleJDK 中的实现
最后更新于