hashMap源码分析_1.7
2021-02-05 14:05:30 5 举报
hashMap源码分析1.7
作者其他创作
大纲/内容
true
e.key == null
int capacity = 1
capacity <<= 1
capacity = roundUpToPowerOf2(threshold)
e != null
reSize(2 * table.length)
this.loadFactor = loadFactor
有
覆盖
抛异常
new HashMap()
e = index[i]去除位置i的元素
initalCapacity 最大值
e.hash = hash && ((k = e.key) == key || key.equals(k))
直接覆盖
hash() 得到hash值
false
loadFactor < =0 || Float.isNaN(loadFactor)
e = e.next
threshold = capacity
initalCapacity = 最大值
key == null
initalCapacity 0
this.loadFactor = 0.75threshold = 16
e = table[0]
构造器中是否有参数
table = Entry[capaticy]
(size >= threshold) && (null != table[index]) 如果列表的长度>=阀值,且table[index]不为空
数组的长度调整为2的次幂
capacity < initaCapacity
initalCapacity
重新计算hash值和位置
table == null
threshold = capacity * loadFactor
收藏
收藏
0 条评论
下一页