mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix bug
This commit is contained in:
@@ -64,6 +64,7 @@
|
||||
* 【core 】 修复Win下文件名带*问题(pr#584@Gitee)
|
||||
* 【core 】 FileUtil.getMimeType增加rar、7z支持(issue#I4ZBN0@Gitee)
|
||||
* 【json 】 JSON修复transient设置无效问题(issue#2212@Github)
|
||||
* 【core 】 修复IterUtil.getElementType获取结果为null的问题(issue#2222@Github)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.7.22 (2022-03-01)
|
||||
|
@@ -643,7 +643,7 @@ public class IterUtil {
|
||||
*/
|
||||
public static Class<?> getElementType(Iterator<?> iterator) {
|
||||
final Iterator<?> iter2 = new CopiedIter<>(iterator);
|
||||
if (iter2.hasNext()) {
|
||||
while (iter2.hasNext()) {
|
||||
final Object t = iter2.next();
|
||||
if (null != t) {
|
||||
return t.getClass();
|
||||
|
@@ -90,6 +90,13 @@ public class IterUtilTest {
|
||||
Assert.assertEquals(expectedMap, testMap);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getElementTypeTest(){
|
||||
List<Integer> integers = Arrays.asList(null, 1);
|
||||
Class<?> elementType = IterUtil.getElementType(integers);
|
||||
Assert.assertEquals(Integer.class,elementType);
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class Car {
|
||||
|
@@ -14,7 +14,7 @@ public class CronPatternNextMatchTest {
|
||||
CronPattern pattern = new CronPattern("23 12 * 12 * * *");
|
||||
//noinspection ConstantConditions
|
||||
final Calendar calendar = pattern.nextMatchAfter(
|
||||
DateUtil.parse("2022-04-12 09:12:12").toCalendar());
|
||||
DateUtil.parse("2022-04-12 09:12:24").toCalendar());
|
||||
|
||||
Console.log(DateUtil.date(calendar));
|
||||
Assert.assertTrue(pattern.match(calendar, true));
|
||||
|
Reference in New Issue
Block a user