1、hashmap屬性概念
https://blog.csdn.net/hollis_chuang/article/details/80402751
2、源碼分析
https://www.cnblogs.com/xiaoxi/p/7233201.html
簡介
HashMap爲數組+鏈表+紅黑樹的數據結構
1、如何hash
static final int hash(Object key) { int h; return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16); }
2、何時擴容
鍵值對大於閥值時或者初始化時,就調用resize方法進行擴容
3、怎麼擴容(2n)
數組大小擴容爲原來的2倍
4、何時由鏈表變成紅黑樹
鏈表大小>8,並且數組長度>64
5、如何獲得原Node
n爲數組長度 (p = tab[i = (n - 1) & hash])