mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
simle code
This commit is contained in:
parent
804d274fd2
commit
4204cb8532
@ -1258,13 +1258,7 @@ public class MapUtil extends MapGetUtil {
|
||||
|
||||
final Map<K, List<V>> map = new HashMap<>();
|
||||
for (final Map.Entry<K, V> pair : entries) {
|
||||
final List<V> values;
|
||||
if (map.containsKey(pair.getKey())) {
|
||||
values = map.get(pair.getKey());
|
||||
} else {
|
||||
values = ListUtil.of();
|
||||
map.put(pair.getKey(), values);
|
||||
}
|
||||
final List<V> values = map.computeIfAbsent(pair.getKey(), k -> new ArrayList<>());
|
||||
values.add(pair.getValue());
|
||||
}
|
||||
return map;
|
||||
|
Loading…
x
Reference in New Issue
Block a user