摘要: 摘抄自:https://www.cnblogs.com/gocode/p/analysis-source-code-of-ConcurrentHashMap.html 1.引子 并发编程中使用HashMap可能导致程序死循环。因为多线程会put方法添加键值对时将导致HashMap的Entry链表形成 阅读全文
posted @ 2020-03-11 13:38 开顺 阅读(598) 评论(0) 推荐(0) 编辑
摘要: static final int tableSizeFor(int cap) { int n = cap - 1; n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16; return (n < 0) ? 1 : 阅读全文
posted @ 2020-03-11 10:24 开顺 阅读(2900) 评论(8) 推荐(1) 编辑