java底层
半生@浮名
半生@浮名
展开
-
arrylist的初始长度和扩容
private static final int DEFAULT_CAPACITY = 10; private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {}; transient Object[] elementData; public ArrayList() { //地址引用,相当于变量的初始化。 ...原创 2019-08-07 14:10:30 · 661 阅读 · 0 评论 -
java1.8 LinkedList的结构原理
public class Test { //链表,先进先出。双向链表结构,项目中可也会用到,其他方法自行研究。也可引申出红黑树,敬请关注我的博客 public static void main(String[] args) { MyLinkedList linkedList = new MyLinkedList(); linkedList.add("a1"...原创 2019-08-07 21:43:15 · 235 阅读 · 0 评论 -
java1.7 hashmap的结构原理
static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; // aka 16 static final int MAXIMUM_CAPACITY = 1 << 30; static final float DEFAULT_LOAD_FACTOR = 0.75f; public HashMap() { t...原创 2019-08-10 15:21:11 · 244 阅读 · 0 评论 -
java1.7 linkedhashmap的结构原理
源码基本和hashmap是一样的,只有一个创建节点的方法不同 hashmap的: void createEntry(int hash, K key, V value, int bucketIndex) { Entry<K,V> e = table[bucketIndex]; table[bucketIndex] = new Entry<...原创 2019-08-10 16:20:36 · 121 阅读 · 0 评论