![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java源码
路漫漫路漫漫
这个作者很懒,什么都没留下…
展开
-
jdk1.8 HashMap红黑树 笔记
static <K,V> TreeNode<K,V> balanceInsertion(TreeNode<K,V> root, TreeNode<K,V> x) { x.red = true; for (TreeNode<K,V> xp, xpp, xppl, xppr;;) { // x新节...原创 2021-05-06 17:14:04 · 122 阅读 · 0 评论 -
jdk1.8扩容 resize() 笔记
final Node<K,V>[] resize() { Node<K,V>[] oldTab = table; // 初始化节点,第一次为null,第二次16 int oldCap = (oldTab == null) ? 0 : oldTab.length; // 第二次16 int oldThr = threshold; // 第一次12 int newCap, newThr = 0; if (..原创 2021-04-03 10:40:47 · 387 阅读 · 3 评论 -
LinkedList源码简单剖析
transient Node<E> first; // 第一个节点 transient Node<E> last; // 最后一个节点 private static class Node<E> { // 声明一个节点,关联上下链表 prev next E item; Node<E> ...原创 2018-08-30 18:31:22 · 159 阅读 · 0 评论 -
Arrays中asList()方法源码剖析
今天偶尔用到了Arrays中asList()方法,就看了下源码;然后想把自己理解的意思分享下,如果哪里写错了,希望大家纠正 // 数组转集合 @SafeVarargs public static <T> List<T> asList(T... a) { return new ArrayList<>(a); // 1.创建一个Ar...原创 2018-08-25 19:54:28 · 563 阅读 · 1 评论 -
HashMap中通过key获取value源码剖析
public V get(Object key) { if (key == null) return getForNullKey(); Entry<K,V> entry = getEntry(key); return null == entry ? null : entry.getValue(); } ...原创 2018-08-09 19:00:07 · 7657 阅读 · 1 评论 -
ArrayList源码简单剖析
private static final int DEFAULT_CAPACITY = 10; private static final Object[] EMPTY_ELEMENTDATA = {}; private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {}; trans...原创 2018-08-29 21:27:26 · 126 阅读 · 0 评论 -
Stack源码简单剖析
boolean empty() 测试堆栈是否为空。 E peek() 查看堆栈顶部的对象,但不从堆栈中移除它。 E pop() 移除堆栈顶部的对象,并作为此函数的值返回该对象。 E push(E item) 把项压入堆栈顶部。 int search(Object o) ...原创 2018-09-02 12:29:49 · 108 阅读 · 0 评论 -
HashMap的put方法源码剖析
/** * HashMap:散列链表结构 * HashMap的put方法,源码分析: * @param key [description] * @param value [description] * @return [description] */ public V put(K key, V value) { if (tab...原创 2018-09-02 14:47:30 · 145 阅读 · 0 评论