![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
集合分析
先生之名
一名Java从业者,爱好源码分析
展开
-
JDK 1.8 HashMap的resize分析
JDK 1.8 HashMap的resize分析final Node<K,V>[] resize() { Node<K,V>[] oldTab = table; // 扩容前table的长度 int oldCap = (oldTab == null) ? 0 : oldTab.length; // 扩容前map的阈值 int oldThr = threshold; // 扩容后table的长度,map的阈值 int newCa原创 2020-05-22 22:16:56 · 283 阅读 · 0 评论 -
ArrayList删除方法解析
ArrayList删除方法解析多种删除方式分析:首先上一段代码:public static void main(String[] args) { List<String> list = new ArrayList<>(); list.add("a"); list.add("b"); list.add("c"); ...原创 2019-05-30 15:52:05 · 1656 阅读 · 0 评论 -
HashMap中tableSizeFor的简要分析
tableSizeForstatic final int tableSizeFor(int cap) { int n = cap - 1; n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >&g...原创 2019-05-30 16:02:15 · 506 阅读 · 0 评论 -
ConcurrentHashMap中tabAt方法分析
ConcurrentHashMap中tabAt方法分析static final <K,V> Node<K,V> tabAt(Node<K,V>[] tab, int i) { return (Node<K,V>)U.getObjectVolatile(tab, ((long)i << ASHIFT) + ABASE);}该...原创 2019-06-13 14:28:58 · 3919 阅读 · 5 评论