HashMap
主要参数: capacity,loadFactor
1 | java.lang.Object |
继承了抽象类AbstractMap,实现了Map、Cloneable、java.io.Serializable接口。
threshold的值=”容量*加载因子”
当HashMap中的容量到threshold,重建Hash表,将容量加倍
table主要存储容器,每个单元Entry都是带hash(int)和next的
为什么使用hash: 为了效率
使用hash会有什么不好的后果 空间换时间,产生哈希冲突
HashMap中如何解决这问题:散列表—>Entry的next