diff --git a/CHANGELOG.md b/CHANGELOG.md index 68281999a..689a4ab6f 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ * 【core 】 ReUtil增加getAllGroups重载(pr#2455@Github) * 【core 】 PageUtil#totalPage增加totalCount为long类型的重载方法(pr#2442@Github) * 【crypto 】 PemUtil.readPemPrivateKey支持pkcs#1格式,增加OpensslKeyUtil(pr#2456@Github) +* 【core 】 添加了通用的注解扫描器 `GenericAnnotationScanner`,并在 `AnnotationScanner` 接口中统一提供了提前配置好的扫描器静态实例(pr#715@Github) * ### 🐞Bug修复 * 【core 】 修复CollUtil里面关于可变参数传null造成的crash问题(pr#2428@Github) @@ -32,6 +33,7 @@ * 【core 】 修复当时间戳为Integer时时间转换问题(pr#2449@Github) * 【core 】 修复bmp文件判断问题(issue#I5H93G@Gitee) * 【core 】 修复CombinationAnnotationElement造成递归循环(issue#I5FQGW@Gitee) +* 【core 】 修复Dict缺少putIfAbsent、computeIfAbsent问题(issue#I5FQGW@Gitee) ------------------------------------------------------------------------------------------------------------- diff --git a/hutool-core/src/main/java/cn/hutool/core/map/TransMap.java b/hutool-core/src/main/java/cn/hutool/core/map/TransMap.java index e6608aec9..08ea433b8 100755 --- a/hutool-core/src/main/java/cn/hutool/core/map/TransMap.java +++ b/hutool-core/src/main/java/cn/hutool/core/map/TransMap.java @@ -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 extends MapWrapper { public V merge(K key, V value, BiFunction 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 mappingFunction) { + return super.computeIfAbsent(customKey(key), mappingFunction); + } //---------------------------------------------------------------------------- Override default methods end /**