@Test(expected = NullPointerException.class) public void testMergeIfOneOFTheArraysIsNull() throws Exception { String[] one = new String[] { "one", "two" }; String[] two = new String[] { "three", "four" }; String[] result = new String[] { "one", "two", "three", "four" }; Assert.assertEquals(result, ArrayUtils.mergeArrays(one, null)); Assert.assertEquals(0, ArrayUtils.mergeArrays(null, null).length); Assert.assertEquals(two, ArrayUtils.mergeArrays(null, two)); }
public static <T> T[] mergeArrays(T[] one, T[] two) { T[] mergedArray = Arrays.copyOf(one, one.length + two.length); System.arraycopy(two, 0, mergedArray, one.length, two.length); return mergedArray; }
ArrayUtils { public static <T> T[] mergeArrays(T[] one, T[] two) { T[] mergedArray = Arrays.copyOf(one, one.length + two.length); System.arraycopy(two, 0, mergedArray, one.length, two.length); return mergedArray; } }
ArrayUtils { public static <T> T[] mergeArrays(T[] one, T[] two) { T[] mergedArray = Arrays.copyOf(one, one.length + two.length); System.arraycopy(two, 0, mergedArray, one.length, two.length); return mergedArray; }  }
ArrayUtils { public static <T> T[] mergeArrays(T[] one, T[] two) { T[] mergedArray = Arrays.copyOf(one, one.length + two.length); System.arraycopy(two, 0, mergedArray, one.length, two.length); return mergedArray; }  static T[] mergeArrays(T[] one, T[] two); static boolean keysPresentInColumns(String[] keys, String[] columns); static String[] convertStringKeyToArray(String keys, String delimiter); static String[] convertStringKeyToArray(String keys); static int[] getCompareColumnsPosition(String[] columns, String[] keyColumns); static List<Integer> getColumnsPosition(String[] columns, String[] keyColumns); static boolean isIndexOfLastArrayElement(String[] array, int elementIndex); }
ArrayUtils { public static <T> T[] mergeArrays(T[] one, T[] two) { T[] mergedArray = Arrays.copyOf(one, one.length + two.length); System.arraycopy(two, 0, mergedArray, one.length, two.length); return mergedArray; }  static T[] mergeArrays(T[] one, T[] two); static boolean keysPresentInColumns(String[] keys, String[] columns); static String[] convertStringKeyToArray(String keys, String delimiter); static String[] convertStringKeyToArray(String keys); static int[] getCompareColumnsPosition(String[] columns, String[] keyColumns); static List<Integer> getColumnsPosition(String[] columns, String[] keyColumns); static boolean isIndexOfLastArrayElement(String[] array, int elementIndex);  }