fix sort bug

This commit is contained in:
Looly 2021-08-19 14:36:07 +08:00
parent 9d8f00e049
commit dbc4fd62ce
2 changed files with 4 additions and 6 deletions

View File

@ -3,7 +3,7 @@
-------------------------------------------------------------------------------------------------------------
# 5.7.10 (2021-08-18)
# 5.7.10 (2021-08-19)
### 🐣新特性
* 【core 】 增加NamingCase类
@ -15,6 +15,7 @@
* 【core 】 XmlUtil增加append重载issue#I466Q0@Gitee
* 【poi 】 增加EscapeStrCellSetterissue#I466ZZ@Gitee
* 【poi 】 ExcelBase增加renameSheet、cloneSheetissue#I466ZZ@Gitee
* 【core 】 修复MapUtil.sort比较器不一致返回原map的问题issue#I46AQJ@Gitee
### 🐞Bug修复

View File

@ -791,18 +791,15 @@ public class MapUtil {
return null;
}
TreeMap<K, V> result;
if (map instanceof TreeMap) {
// 已经是可排序Map此时只有比较器一致才返回原map
result = (TreeMap<K, V>) map;
TreeMap<K, V> result = (TreeMap<K, V>) map;
if (null == comparator || comparator.equals(result.comparator())) {
return result;
}
} else {
result = newTreeMap(map, comparator);
}
return result;
return newTreeMap(map, comparator);
}
/**