@Test public void testConcatDoubles() { double[] d1 = {1, 2, 3}; double[] d2 = {4, 5}; double[] d3 = {6, 7}; assertArrayEquals(new double[]{1, 2, 3, 4, 5, 6, 7}, Arrays2.concat(d1, d2, d3), NO_DELTA); assertArrayEquals(new double[]{}, Arrays2.concat(), NO_DELTA); assertArrayEquals(new double[]{4, 5}, Arrays2.concat(d2), NO_DELTA); assertNotSame(new double[]{4, 5}, Arrays2.concat(d2)); }
public static <T> T[] concat(T[] first, T[] second) { if (first == null) return second; else if (second == null) return first; T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; }
Arrays2 { public static <T> T[] concat(T[] first, T[] second) { if (first == null) return second; else if (second == null) return first; T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; } }
Arrays2 { public static <T> T[] concat(T[] first, T[] second) { if (first == null) return second; else if (second == null) return first; T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; } private  Arrays2(); }
Arrays2 { public static <T> T[] concat(T[] first, T[] second) { if (first == null) return second; else if (second == null) return first; T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; } private  Arrays2(); static void copy(final double[] sourceArray,
            final double[] destinationArray, final int length); static void reverse(final double[] array); static void reverse(final double[] array, final int start, final int n); static void reverse(final int[] array); static void reverse(final int[] array, final int start, final int n); static void reverse(final Object[] array); static void reverse(final Object[] array, final int start, final int n); static void swap(double array[], int a, int b); static void swap(int array[], int a, int b); static void swap(Object array[], int a, int b); static boolean isNullOrEmpty(Object[] array); static boolean isNullOrEmpty(double[] array); static boolean isNullOrEmpty(int[] array); static T[] copyOf(T[] original); static T[] concat(T[] first, T[] second); static double[] concat(double[]... arrays); static double[] compact(final double[] array); static void shift(double[] array, int shiftsize); static void shift(double[] array, int shiftsize, int fromIndex, int toIndex); static boolean isArray(Object o); static boolean arrayEquals(T oldValue, T newValue); static List<T> unmodifiableList(T... array); }
Arrays2 { public static <T> T[] concat(T[] first, T[] second) { if (first == null) return second; else if (second == null) return first; T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; } private  Arrays2(); static void copy(final double[] sourceArray,
            final double[] destinationArray, final int length); static void reverse(final double[] array); static void reverse(final double[] array, final int start, final int n); static void reverse(final int[] array); static void reverse(final int[] array, final int start, final int n); static void reverse(final Object[] array); static void reverse(final Object[] array, final int start, final int n); static void swap(double array[], int a, int b); static void swap(int array[], int a, int b); static void swap(Object array[], int a, int b); static boolean isNullOrEmpty(Object[] array); static boolean isNullOrEmpty(double[] array); static boolean isNullOrEmpty(int[] array); static T[] copyOf(T[] original); static T[] concat(T[] first, T[] second); static double[] concat(double[]... arrays); static double[] compact(final double[] array); static void shift(double[] array, int shiftsize); static void shift(double[] array, int shiftsize, int fromIndex, int toIndex); static boolean isArray(Object o); static boolean arrayEquals(T oldValue, T newValue); static List<T> unmodifiableList(T... array); static final String[] EMPTY_STRING_ARRAY; static final int[] EMPTY_INT_ARRAY; static final long[] EMPTY_LONG_ARRAY; static final double[] EMPTY_DOUBLE_ARRAY; static final boolean[] EMPTY_BOOLEAN_ARRAY; }