因为按位运算比取余操作快很多。
当length一定是2^n时,h & (length - 1) == h % length。
此时可以使用位运算来替代取余运算。
hashmap中为啥容量限制为2的N次方?
猜你喜欢
转载自www.cnblogs.com/xxxuwentao/p/10151509.html
今日推荐
周排行