From 59f5a1d17b4a4f0bf968489b6eea23d4792eb170 Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Mon, 26 Jun 2023 09:10:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20concat=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E7=9A=84=E5=AE=9E=E7=8E=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plusone/commons/util/MoreArrays.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/main/java/xyz/zhouxy/plusone/commons/util/MoreArrays.java b/src/main/java/xyz/zhouxy/plusone/commons/util/MoreArrays.java index 617a14b..eac306e 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/util/MoreArrays.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/util/MoreArrays.java @@ -36,9 +36,8 @@ public class MoreArrays { float[] result = new float[length]; int i = 0; for (float[] arr : arrays) { - for (float item : arr) { - result[i++] = item; - } + System.arraycopy(arr, 0, result, i, arr.length); + i = arr.length; } return result; } @@ -51,9 +50,8 @@ public class MoreArrays { double[] result = new double[length]; int i = 0; for (double[] arr : arrays) { - for (double item : arr) { - result[i++] = item; - } + System.arraycopy(arr, 0, result, i, arr.length); + i = arr.length; } return result; } @@ -66,9 +64,8 @@ public class MoreArrays { byte[] result = new byte[length]; int i = 0; for (byte[] arr : arrays) { - for (byte item : arr) { - result[i++] = item; - } + System.arraycopy(arr, 0, result, i, arr.length); + i = arr.length; } return result; } @@ -81,9 +78,8 @@ public class MoreArrays { long[] result = new long[length]; int i = 0; for (long[] arr : arrays) { - for (long item : arr) { - result[i++] = item; - } + System.arraycopy(arr, 0, result, i, arr.length); + i = arr.length; } return result; } @@ -96,9 +92,8 @@ public class MoreArrays { int[] result = new int[length]; int i = 0; for (int[] arr : arrays) { - for (int item : arr) { - result[i++] = item; - } + System.arraycopy(arr, 0, result, i, arr.length); + i = arr.length; } return result; }