From 18b340e61dcb23b01b4960857669b9a9cd93296d Mon Sep 17 00:00:00 2001 From: looly Date: Mon, 13 Dec 2021 09:34:15 +0800 Subject: [PATCH] fix bug --- CHANGELOG.md | 3 ++- hutool-json/src/main/java/cn/hutool/json/JSONObject.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6cd6b158..474e00d15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ------------------------------------------------------------------------------------------------------------- -# 5.7.18 (2021-12-12) +# 5.7.18 (2021-12-13) ### 🐣新特性 * 【core 】 新增CollStreamUtil.groupKeyValue(pr#479@Gitee) @@ -12,6 +12,7 @@ * 【core 】 LineReadWatcher#onModify文件清空判断问题(issue#2013@Github) * 【core 】 修复4位bytes转换float问题(issue#I4M0E4@Gitee) * 【core 】 修复CharSequenceUtil.replace问题(issue#I4M16G@Gitee) +* 【json 】 修复JSONObject 初始化大小值未被使用问题(issue#2016@Github) ------------------------------------------------------------------------------------------------------------- # 5.7.17 (2021-12-09) diff --git a/hutool-json/src/main/java/cn/hutool/json/JSONObject.java b/hutool-json/src/main/java/cn/hutool/json/JSONObject.java index ca7c08613..403070853 100644 --- a/hutool-json/src/main/java/cn/hutool/json/JSONObject.java +++ b/hutool-json/src/main/java/cn/hutool/json/JSONObject.java @@ -123,7 +123,7 @@ public class JSONObject implements JSON, JSONGetter, Map if (config.isIgnoreCase()) { this.rawHashMap = config.isOrder() ? new CaseInsensitiveLinkedMap<>(capacity) : new CaseInsensitiveMap<>(capacity); } else { - this.rawHashMap = MapUtil.newHashMap(config.isOrder()); + this.rawHashMap = MapUtil.newHashMap(capacity, config.isOrder()); } this.config = config; }