mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
Merge pull request #2969 from LuisStruggle/v6-dev-3
fix:ArrayUtil.addAll()方法,判断空数据组优化
This commit is contained in:
commit
9f18f16e32
@ -588,15 +588,19 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
||||
|
||||
int length = 0;
|
||||
for (final T[] array : arrays) {
|
||||
if (null != array) {
|
||||
if (isNotEmpty(array)) {
|
||||
length += array.length;
|
||||
}
|
||||
}
|
||||
|
||||
final T[] result = newArray(arrays.getClass().getComponentType().getComponentType(), length);
|
||||
if (length == 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
length = 0;
|
||||
for (final T[] array : arrays) {
|
||||
if (null != array) {
|
||||
if (isNotEmpty(array)) {
|
||||
System.arraycopy(array, 0, result, length, array.length);
|
||||
length += array.length;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user