首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

HashMap的hash()步骤求祥解

2012-11-04 
HashMap的hash()方法求祥解昨天闲来无事看HashMap的源代码,看到这里hash()方法,自己都搞不懂为什么是这个

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);}

热点排行