/** * 合并任意个数组 * @param first * @param rest * @param <T> * @return */ public static <T> T[] concat(T[] first, T[]... rest) { int totalLength = first.length; for (T[] array : rest) { totalLength += array.length; } T[] result = java.util.Arrays.copyOf(first, totalLength); int offset = first.length; for (T[] array : rest) { System.arraycopy(array, 0, result, offset, array.length); offset += array.length; } return result; }
时间: 2024-11-03 21:58:53