CollectionUtil { public static <T> Set<T> symmetricDifference(Collection<? extends T> c1, Collection<? extends T> c2) { Set<T> diff1 = new HashSet<>(c1); diff1.removeAll(c2); Set<T> diff2 = new HashSet<>(c2); diff2.removeAll(c1); diff1.addAll(diff2); return diff1; }  static String mkString(Collection<?> collection, String sep); static String mkString(Collection<T> collection, String start, String sep, String end); static boolean equalContentsIgnoreOrder(Collection<?> c1, Collection<?> c2); static Set<T> symmetricDifference(Collection<? extends T> c1, Collection<? extends T> c2); static Collection<T> filter(Collection<?> collection, Class<T> lowerBound); static T first(Collection<T> collection); static Optional<T> firstMatching(T[] array, Predicate<? super T> predicate);  }
@Test public void testSymmetricDifference() { assertTrue(CollectionUtil.equalContentsIgnoreOrder( Arrays.asList(1, 2, 3), CollectionUtil.symmetricDifference(l1, l2))); }