HashMap应指定初始长度

This commit is contained in:
achao 2021-11-10 20:33:02 +08:00
parent 8e0a5e2029
commit c8743914f1

View File

@ -179,7 +179,7 @@ public class CollStreamUtil {
Set<K> key = new HashSet<>();
key.addAll(map1.keySet());
key.addAll(map2.keySet());
Map<K, V> map = new HashMap<>();
Map<K, V> map = MapUtil.newHashMap(key.size());
for (K t : key) {
X x = map1.get(t);
Y y = map2.get(t);