修复Dict缺少putIfAbsent、computeIfAbsent问题

This commit is contained in:
Looly
2022-07-19 11:09:55 +08:00
parent faa6eebe52
commit 28fde6ddcf

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(final K key, final V value, final 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
/**