修复CollUtil.lastIndexOf序号错误问题

This commit is contained in:
Looly 2022-08-20 00:54:22 +08:00
parent a60aa0ec47
commit 26e5077181
2 changed files with 4 additions and 3 deletions

View File

@ -3,7 +3,7 @@
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
# 5.8.6.M1 (2022-08-16) # 5.8.6.M1 (2022-08-20)
### 🐣新特性 ### 🐣新特性
* 【core 】 CollUtil新增addIfAbsent方法pr#750@Gitee * 【core 】 CollUtil新增addIfAbsent方法pr#750@Gitee
@ -16,6 +16,7 @@
* 【core 】 修复RandomUtil#randomString 入参length为负数时报错问题issue#2515@Github * 【core 】 修复RandomUtil#randomString 入参length为负数时报错问题issue#2515@Github
* 【core 】 修复SecureUtil传入null的key抛出异常问题pr#2521@Github * 【core 】 修复SecureUtil传入null的key抛出异常问题pr#2521@Github
* 【core 】 修复UrlBuilder的toURI方法将url重复编码issue#2503@Github * 【core 】 修复UrlBuilder的toURI方法将url重复编码issue#2503@Github
* 【core 】 修复CollUtil.lastIndexOf序号错误问题
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------

View File

@ -1608,12 +1608,12 @@ public class CollUtil {
} }
int matchIndex = -1; int matchIndex = -1;
if (isNotEmpty(collection)) { if (isNotEmpty(collection)) {
int index = collection.size(); int index = 0;
for (T t : collection) { for (T t : collection) {
if (null == matcher || matcher.match(t)) { if (null == matcher || matcher.match(t)) {
matchIndex = index; matchIndex = index;
} }
index--; index++;
} }
} }
return matchIndex; return matchIndex;