add default value for ArrayUtil.unwrap

This commit is contained in:
Looly 2020-10-09 16:01:25 +08:00
parent 25e57bd4e9
commit 69362f1031
2 changed files with 5 additions and 4 deletions

View File

@ -9,6 +9,7 @@
* 【core 】 ConsoleTable代码优化pr#190@Gitee
* 【http 】 HttpRequest增加setProxy重载pr#190@Gitee
* 【core 】 XmlUtil.cleanCommentpr#191@Gitee
* 【core 】 ArrayUtil.unWrap增加默认值pr#1149@Github
### Bug修复
* 【core 】 解决农历判断节日未判断大小月导致的问题issue#I1XHSF@Gitee

View File

@ -1777,7 +1777,7 @@ public class ArrayUtil {
}
/**
* 包装类数组转为原始类型数组
* 包装类数组转为原始类型数组null转为0
*
* @param values 包装类型数组
* @return 原始类型数组
@ -1793,7 +1793,7 @@ public class ArrayUtil {
final int[] array = new int[length];
for (int i = 0; i < length; i++) {
array[i] = values[i];
array[i] = ObjectUtil.defaultIfNull(values[i], 0);
}
return array;
}
@ -1837,7 +1837,7 @@ public class ArrayUtil {
final long[] array = new long[length];
for (int i = 0; i < length; i++) {
array[i] = values[i];
array[i] = ObjectUtil.defaultIfNull(values[i], 0L);
}
return array;
}
@ -1881,7 +1881,7 @@ public class ArrayUtil {
char[] array = new char[length];
for (int i = 0; i < length; i++) {
array[i] = values[i];
array[i] = ObjectUtil.defaultIfNull(values[i], Character.MIN_VALUE);
}
return array;
}