JDK8 hashmap扩容优化
背景
在jdk7中hashmap在高并发下扩容回出现死循环,jdk8中优化了死循环
源码
final Node<K,V>[] resize() {
Node<K,V>[] oldTab = table;
// oldCap当前数组长度
int oldCap = (oldTab == null) ? 0 : oldTab.length;
// oldThr当前最大扩容阈值
int oldThr = thre
原创
2022-01-26 11:13:50 ·
264 阅读 ·
0 评论