Merge pull request #2969 from LuisStruggle/v6-dev-3

fix:ArrayUtil.addAll()方法,判断空数据组优化
This commit is contained in:
Golden Looly
2023-03-10 22:12:08 +08:00
committed by GitHub

View File

@@ -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;
}