@Test public void testWithZeroArray() { Object[] result = ArrayUtils.concatArrays(); assertArrayEquals(testArray(), result); }
public static Object[] concatArrays(Object[]... arrays) { int length = 0; for (Object[] array: arrays) { length += array.length; } Object[] result = new Object[length]; int offset = 0; for (Object[] array: arrays) { System.arraycopy(array, 0, result, offset, array.length); offset += array.length; } return result; }
ArrayUtils { public static Object[] concatArrays(Object[]... arrays) { int length = 0; for (Object[] array: arrays) { length += array.length; } Object[] result = new Object[length]; int offset = 0; for (Object[] array: arrays) { System.arraycopy(array, 0, result, offset, array.length); offset += array.length; } return result; } }
ArrayUtils { public static Object[] concatArrays(Object[]... arrays) { int length = 0; for (Object[] array: arrays) { length += array.length; } Object[] result = new Object[length]; int offset = 0; for (Object[] array: arrays) { System.arraycopy(array, 0, result, offset, array.length); offset += array.length; } return result; } private  ArrayUtils(); }
ArrayUtils { public static Object[] concatArrays(Object[]... arrays) { int length = 0; for (Object[] array: arrays) { length += array.length; } Object[] result = new Object[length]; int offset = 0; for (Object[] array: arrays) { System.arraycopy(array, 0, result, offset, array.length); offset += array.length; } return result; } private  ArrayUtils(); static Object[] concatArrays(Object[]... arrays); }
ArrayUtils { public static Object[] concatArrays(Object[]... arrays) { int length = 0; for (Object[] array: arrays) { length += array.length; } Object[] result = new Object[length]; int offset = 0; for (Object[] array: arrays) { System.arraycopy(array, 0, result, offset, array.length); offset += array.length; } return result; } private  ArrayUtils(); static Object[] concatArrays(Object[]... arrays);  }