![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
concurrentHashMap
blingfeng
这个作者很懒,什么都没留下…
展开
-
ConcurrentHashMap源码之tryPreSize
tryPreSize是ConcurrentHashMap扩容方法之一 private final void tryPresize(int size) { //如果大小为MAXIMUM_CAPACITY最大总量的一半,那么直接扩容为MAXIMUM_CAPACITY,否则计算最小幂次方 int c = (size >= (MAXIMUM_CAPACITY >>>...原创 2018-04-08 17:48:26 · 1987 阅读 · 1 评论 -
ConcurrentHashMap之核心方法分析(JDK1.8)
ConcurrentHashMap是java.util.concurrent并发包下的一个类,相比jdk1.7,jdk1.8使用了cas来替代分段锁,其和HashMap一样底层使用了数组+链表+红黑树。字段 private static final int MAXIMUM_CAPACITY = 1 << 30;//最大容量 2^30 private static final i...原创 2018-04-09 10:35:54 · 184 阅读 · 0 评论