在搜索 HashMap 实现后,在http://www.docjar.com/html/api/java/util/HashMap.java.html上找到了此代码。
264 static int hash(int h) {
265 // This function ensures that hashCodes that differ only by
266 // constant multiples at each bit position have a bounded
267 // number of collisions (approximately 8 at default load factor).
268 h ^= (h >>> 20) ^ (h >>> 12);
269 return h ^ (h >>> 7) ^ (h >>> 4);
270 }
有人可以对此有所了解吗?评论告诉我们为什么这段代码在这里,但我想了解这如何改善不良哈希值以及它如何保证位置具有有限数量的冲突。这些神奇的数字是什么意思?