为什么要讲容量设置为2的N次放
1 h&(length-1)=h%length length必须为2的N次方
2 位运算符耗时:2640ms
取模运算:25157 (取模运算太耗费时间)
3 数组扩容,大量rehash(取模)
HashMap中的一些面试题
原文:https://www.cnblogs.com/shujiying/p/12422738.html