扩容
1.使用位运算计算size
//ArrayList首次扩容1.5倍
int newCapacity = oldCapacity + (oldCapacity >> 1);
//Hashmap 每次扩容2倍
capacity <<= 1;
2.大部分首次扩容两倍,特例:ArrayList首次扩容1.5倍
3.HashMap的默认装载因子为0.75
4.HashSet是基于HashMap实现的
1.使用位运算计算size
//ArrayList首次扩容1.5倍
int newCapacity = oldCapacity + (oldCapacity >> 1);
//Hashmap 每次扩容2倍
capacity <<= 1;
2.大部分首次扩容两倍,特例:ArrayList首次扩容1.5倍
3.HashMap的默认装载因子为0.75
4.HashSet是基于HashMap实现的