结合源码解读HashMap的实现
本文主要结合 JDK8 之后的 HashMap 源码思想,系统讲清楚 Java 中 HashMap 的底层原理(数组 + 铉表 + 红黑树)。 # 一、HashMap 总体结构 JDK8 中 HashMap 的核心结构: 数组(Node<K,V>[] table) ↓ 数组每个位置是一个链表 ↓ 链表过长转为红黑树 即: 数组 + 链表 + 红黑树 核心成员变量(JDK8): transient Node<K,V>[] table; // 哈希桶数组transient int size; // 元素个数int threshold; //...
more...



