修复Dict缺少putIfAbsent、computeIfAbsent问题

This commit is contained in:
Looly
2022-07-19 10:57:18 +08:00
parent fad4886722
commit e3b296e89d
2 changed files with 13 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package cn.hutool.core.map;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
/**
@@ -98,6 +99,16 @@ public abstract class TransMap<K, V> extends MapWrapper<K, V> {
public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
return super.merge(customKey(key), customValue(value), (v1, v2) -> remappingFunction.apply(customValue(v1), customValue(v2)));
}
@Override
public V putIfAbsent(K key, V value) {
return super.putIfAbsent(customKey(key), customValue(value));
}
@Override
public V computeIfAbsent(final K key, final Function<? super K, ? extends V> mappingFunction) {
return super.computeIfAbsent(customKey(key), mappingFunction);
}
//---------------------------------------------------------------------------- Override default methods end
/**