java
PatrickPan2018
https://github.com/PatrickPan2012
https://leetcode.com/patrickpan2012/
展开
-
JDK8 TreeMap、HashMap、ConcurrentHashMap和LongAdder
JDK8 TreeMap、HashMap、ConcurrentHashMap和LongAdder原创 2022-05-31 21:49:18 · 115 阅读 · 0 评论 -
JDK8 LongAdder源码浅析
/** * Base value, used mainly when there is no contention, but also as a * fallback during table initialization races. Updated via CAS. */ volatile long base; /** * Table of cells. When non-null, size is a power of 2. */ volatile Cell[] ce..原创 2022-05-31 08:58:24 · 91 阅读 · 0 评论 -
JDK8 ConcurrentHashMap源码浅析
DEFAULT_CAPACITY = 16; // 默认数组长度 TREEIFY_THRESHOLD = 8; // 单向链表转双向链表和红黑树需要满足的第一个条件 MIN_TREEIFY_CAPACITY = 64; // 单向链表转双向链表和红黑树需要满足的第二个条件 /** * Table initialization and resizing control. When negative, the * table is being initialized ..原创 2022-05-29 11:10:14 · 154 阅读 · 0 评论 -
JDK8 HashMap源码浅析
DEFAULT_INITIAL_CAPACITY = 16; // 默认数组长度 MAXIMUM_CAPACITY = 1 << 30; // 大于1000,000,000,即10亿 DEFAULT_LOAD_FACTOR = 0.75f; // 用于计算threshold TREEIFY_THRESHOLD = 8; // 单向链表转双向链表和红黑树需要满足的第一个条件 UNTREEIFY_THRESHOLD = 6; // 在resize操作时,双向链表和红黑树转单向链表..原创 2022-05-19 17:05:01 · 201 阅读 · 0 评论 -
JDK8 TreeMap源码浅析
增加元素 public V put(K key, V value) { Entry<K,V> t = root; if (t == null) { // 空树,直接插入并结束 compare(key, key); // type (and possibly null) check root = new Entry<>(key, value, null);原创 2022-05-17 09:35:21 · 133 阅读 · 0 评论 -
Thread & InterruptedException
If a thread is not active, Thread.interrupt() will not have any effects on it andThread.isInterrupted() will remain to be false.public static void main(String[] args) throws InterruptedException {...原创 2019-07-08 15:54:30 · 454 阅读 · 0 评论