@SuppressWarnings("unchecked") @Test public void xor() { assertEquals("[1, 4]", Xor.xor(asList(1, 2), asList(4, 2)).toString()); }
@SuppressWarnings("unchecked") public static <T> List<T> xor(final List<T> ... lists) { int index = -1; int length = lists.length; List<T> result = null; while (++index < length) { final List<T> array = lists[index]; result = result == null ? array : concat(difference(result, array), difference(array, result)); } return uniq(result); }
Xor { @SuppressWarnings("unchecked") public static <T> List<T> xor(final List<T> ... lists) { int index = -1; int length = lists.length; List<T> result = null; while (++index < length) { final List<T> array = lists[index]; result = result == null ? array : concat(difference(result, array), difference(array, result)); } return uniq(result); } }
Xor { @SuppressWarnings("unchecked") public static <T> List<T> xor(final List<T> ... lists) { int index = -1; int length = lists.length; List<T> result = null; while (++index < length) { final List<T> array = lists[index]; result = result == null ? array : concat(difference(result, array), difference(array, result)); } return uniq(result); }  }
Xor { @SuppressWarnings("unchecked") public static <T> List<T> xor(final List<T> ... lists) { int index = -1; int length = lists.length; List<T> result = null; while (++index < length) { final List<T> array = lists[index]; result = result == null ? array : concat(difference(result, array), difference(array, result)); } return uniq(result); }  static List<E> uniq(final List<E> list); static Optional<E> find(final Iterable<E> iterable, final Predicate<E> pred); static boolean some(final Iterable<E> iterable, final Predicate<E> pred); static boolean contains(final Iterable<E> iterable, final E elem); static List<E> filter(final List<E> list, final Predicate<E> pred); static List<E> difference(final List<E> list1, final List<E> list2); static List<T> concat(final List<T> ... other); @SuppressWarnings("unchecked") static List<T> xor(final List<T> ... lists); }
Xor { @SuppressWarnings("unchecked") public static <T> List<T> xor(final List<T> ... lists) { int index = -1; int length = lists.length; List<T> result = null; while (++index < length) { final List<T> array = lists[index]; result = result == null ? array : concat(difference(result, array), difference(array, result)); } return uniq(result); }  static List<E> uniq(final List<E> list); static Optional<E> find(final Iterable<E> iterable, final Predicate<E> pred); static boolean some(final Iterable<E> iterable, final Predicate<E> pred); static boolean contains(final Iterable<E> iterable, final E elem); static List<E> filter(final List<E> list, final Predicate<E> pred); static List<E> difference(final List<E> list1, final List<E> list2); static List<T> concat(final List<T> ... other); @SuppressWarnings("unchecked") static List<T> xor(final List<T> ... lists);  }