java
煜帝hhhh
学习无止境,加油!
展开
-
Hashmap源码分析
写在前面 本文是针对JDK版本1.8的,可能与其他版本有出入。 全局变量 // 序列化id private static final long serialVersionUID = 362498820763181265L; // 默认容量16 static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; // aka 16 // 最大容量 2的30次方 static final int MAXIMUM_CAPACITY = 1 << 30原创 2020-10-10 15:59:07 · 105 阅读 · 0 评论 -
Java中String和new String()区别
String string = “abc” 在执行的过程中,首先在栈区创建string引用,然后JVM会从常量池中查询是否存在"abc"这个对象,存在则直接把常量池中"abc"的地址返回给string。如果不存在,则在常量池中创建"abc"对象并返回地址给string1。 String string1 = "abc"; String string2 = "abc"; System.out.println(string1 == string2); //true原创 2020-09-22 16:35:05 · 412 阅读 · 0 评论 -
LinkedList源码分析(小白都能看懂)
写在前面 本文是针对JDK版本1.8的,可能与其他版本有出入。 全局变量 transient int size = 0; //结点个数 transient Node<E> first; //头结点 transient Node<E> last; //尾结点 元素的存储结构 private static class Node<E> { E item; //存储的元素 Node<E> next; //下一个元素结原创 2020-09-17 20:27:05 · 320 阅读 · 0 评论 -
ArrayList源码分析(小白都能看懂)
ArrayList源码分析 写在前面 本文是针对JDK版本1.8的,可能与其他版本有出入。 全局变量 // 1.序列化id private static final long serialVersionUID = 8683452581122892189L; // 2.默认容量 private static final int DEFAULT_CAPACITY = 10; // 3.空的对象数组 private static final Object[] EMPTY_ELEMENTDATA = {}; //原创 2020-09-13 11:16:42 · 162 阅读 · 0 评论