![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hashmap
Summer_i
这个作者很懒,什么都没留下…
展开
-
HashMap hash方法与indexFor 方法
//put方法时候使用的扰动函数 static final int hash(Object key) { int h; return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16); } //获取table中的位置 static int indexFor(int h, int l...原创 2020-04-24 15:16:35 · 337 阅读 · 0 评论 -
currenthashmap为什么比hashmap自己加锁效率要高
因为currenthashmap将数据分段,分成一段一段的,每一段都加锁,锁分离技术,访问的时候,访问第一段数据,第一段加锁,第二段没有锁,其他线程还是可以访问第二段的数据的,所以比自己hashmap加锁的效率要高...原创 2018-03-28 14:58:16 · 1561 阅读 · 0 评论