@Test public void getEmptyUncontainedArray() throws Exception { String[] subArray = {"e"}; String[] containerArray = {"d","e","f"}; String[] result = ListProcessor.getUncontainedArray(subArray,containerArray, true); List<String> listResult = Arrays.asList(result); assertEquals(listResult, Collections.emptyList()); }
public static String[] getUncontainedArray(String[] subArray, String[] containerArray, boolean ignoreCase) { String[] uncontainedArray = new String[subArray.length]; int index = 0; boolean found = false; for (String subStr : subArray) { for (String contStr : containerArray) { found = elementsAreEqual(subStr, contStr, ignoreCase); if (found) { break; } } if (!found) { uncontainedArray[index] = subStr; index++; } } String[] newUncontainedArray = new String[index]; System.arraycopy(uncontainedArray, 0, newUncontainedArray, 0, index); return newUncontainedArray; }
ListProcessor { public static String[] getUncontainedArray(String[] subArray, String[] containerArray, boolean ignoreCase) { String[] uncontainedArray = new String[subArray.length]; int index = 0; boolean found = false; for (String subStr : subArray) { for (String contStr : containerArray) { found = elementsAreEqual(subStr, contStr, ignoreCase); if (found) { break; } } if (!found) { uncontainedArray[index] = subStr; index++; } } String[] newUncontainedArray = new String[index]; System.arraycopy(uncontainedArray, 0, newUncontainedArray, 0, index); return newUncontainedArray; } }
ListProcessor { public static String[] getUncontainedArray(String[] subArray, String[] containerArray, boolean ignoreCase) { String[] uncontainedArray = new String[subArray.length]; int index = 0; boolean found = false; for (String subStr : subArray) { for (String contStr : containerArray) { found = elementsAreEqual(subStr, contStr, ignoreCase); if (found) { break; } } if (!found) { uncontainedArray[index] = subStr; index++; } } String[] newUncontainedArray = new String[index]; System.arraycopy(uncontainedArray, 0, newUncontainedArray, 0, index); return newUncontainedArray; }  }
ListProcessor { public static String[] getUncontainedArray(String[] subArray, String[] containerArray, boolean ignoreCase) { String[] uncontainedArray = new String[subArray.length]; int index = 0; boolean found = false; for (String subStr : subArray) { for (String contStr : containerArray) { found = elementsAreEqual(subStr, contStr, ignoreCase); if (found) { break; } } if (!found) { uncontainedArray[index] = subStr; index++; } } String[] newUncontainedArray = new String[index]; System.arraycopy(uncontainedArray, 0, newUncontainedArray, 0, index); return newUncontainedArray; }  static String[] toArray(String list, String delimiter); static int getIndex(String index, int listLength); static String[] reverse(String[] list); static int[] reverse(int[] list); static double[] reverse(double[] list); static int[] toIntArray(String list, String delimiter); static double[] toDoubleArray(String list, String delimiter); static String toString(double[] list, String delimiter); static String toString(int[] list, String delimiter); static String toString(String[] list, String delimiter); static String[] sort(String[] unsorted); static int[] sort(int[] unsorted); static double[] sort(double[] unsorted); static int[] trimPercent(int[] array, int percent); static String[] trimPercent(String[] array, int percent); static double[] trimPercent(double[] array, int percent); static boolean arrayElementsAreNull(String[] uncontainedArray); static String[] getUncontainedArray(String[] subArray, String[] containerArray, boolean ignoreCase); static boolean elementsAreEqual(String a, String b, boolean ignoreCase); }
ListProcessor { public static String[] getUncontainedArray(String[] subArray, String[] containerArray, boolean ignoreCase) { String[] uncontainedArray = new String[subArray.length]; int index = 0; boolean found = false; for (String subStr : subArray) { for (String contStr : containerArray) { found = elementsAreEqual(subStr, contStr, ignoreCase); if (found) { break; } } if (!found) { uncontainedArray[index] = subStr; index++; } } String[] newUncontainedArray = new String[index]; System.arraycopy(uncontainedArray, 0, newUncontainedArray, 0, index); return newUncontainedArray; }  static String[] toArray(String list, String delimiter); static int getIndex(String index, int listLength); static String[] reverse(String[] list); static int[] reverse(int[] list); static double[] reverse(double[] list); static int[] toIntArray(String list, String delimiter); static double[] toDoubleArray(String list, String delimiter); static String toString(double[] list, String delimiter); static String toString(int[] list, String delimiter); static String toString(String[] list, String delimiter); static String[] sort(String[] unsorted); static int[] sort(int[] unsorted); static double[] sort(double[] unsorted); static int[] trimPercent(int[] array, int percent); static String[] trimPercent(String[] array, int percent); static double[] trimPercent(double[] array, int percent); static boolean arrayElementsAreNull(String[] uncontainedArray); static String[] getUncontainedArray(String[] subArray, String[] containerArray, boolean ignoreCase); static boolean elementsAreEqual(String a, String b, boolean ignoreCase);  }