
java
煜帝hhhh
学习无止境,加油!
展开
-
Hashmap源码分析
写在前面本文是针对JDK版本1.8的,可能与其他版本有出入。全局变量// 序列化idprivate static final long serialVersionUID = 362498820763181265L;// 默认容量16static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; // aka 16// 最大容量 2的30次方static final int MAXIMUM_CAPACITY = 1 << 30原创 2020-10-10 15:59:07 · 146 阅读 · 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 · 453 阅读 · 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 · 362 阅读 · 0 评论 -
ArrayList源码分析(小白都能看懂)
ArrayList源码分析写在前面本文是针对JDK版本1.8的,可能与其他版本有出入。全局变量// 1.序列化idprivate 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 · 204 阅读 · 0 评论