HashMap的hash()方法求祥解
昨天闲来无事看HashMap的源代码,看到这里hash()方法,自己都搞不懂为什么是这个算法,有哪位大侠指点指点,谢谢了
static int hash(int h) {// This function ensures that hashCodes that differ only by// constant multiples at each bit position have a bounded// number of collisions (approximately 8 at default load factor).h ^= (h >>> 20) ^ (h >>> 12);return h ^ (h >>> 7) ^ (h >>> 4);}