ArrayUtils { public static String[] convertStringKeyToArray(String keys, String delimiter) { if (delimiter == null) { delimiter = CONSTANTS.DELIMITER; } return keys.split(delimiter); }  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);  }
@Test public void testDelimiterSplit() throws Exception { String line = "one two three four"; String[] items = ArrayUtils.convertStringKeyToArray(line); Assert.assertEquals("one", items[0]); Assert.assertEquals("two", items[1]); Assert.assertEquals("three", items[2]); Assert.assertEquals("four", items[3]); }
@Test public void testDelimiterSplitWillNullDelimiter() throws Exception { String line = "one two three four"; String[] items = ArrayUtils.convertStringKeyToArray(line, null); Assert.assertEquals("one", items[0]); Assert.assertEquals("two", items[1]); Assert.assertEquals("three", items[2]); Assert.assertEquals("four", items[3]); }