diff --git a/CHANGELOG.md b/CHANGELOG.md index dab30a516..c1328a285 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ------------------------------------------------------------------------------------------------------------- -# 5.8.6.M1 (2022-08-16) +# 5.8.6.M1 (2022-08-20) ### 🐣新特性 * 【core 】 CollUtil新增addIfAbsent方法(pr#750@Gitee) @@ -16,6 +16,7 @@ * 【core 】 修复RandomUtil#randomString 入参length为负数时报错问题(issue#2515@Github) * 【core 】 修复SecureUtil传入null的key抛出异常问题(pr#2521@Github) * 【core 】 修复UrlBuilder的toURI方法将url重复编码(issue#2503@Github) +* 【core 】 修复CollUtil.lastIndexOf序号错误问题 ------------------------------------------------------------------------------------------------------------- diff --git a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java b/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java index cefedc5f4..977dbcd87 100755 --- a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java @@ -1608,12 +1608,12 @@ public class CollUtil { } int matchIndex = -1; if (isNotEmpty(collection)) { - int index = collection.size(); + int index = 0; for (T t : collection) { if (null == matcher || matcher.match(t)) { matchIndex = index; } - index--; + index++; } } return matchIndex;