### Question:
CollectionUtil { @SuppressWarnings({ "rawtypes", "unchecked" }) public static <T> Collection<Pair<T, T>> intersection( Collection<T> oldList, Collection<T> newList, java.util.Comparator comparator) { Collection<Pair<T, T>> result = new ArrayList<Pair<T, T>>(); for (T oldValue : oldList) { for (T newValue : newList) { if (comparator.compare(oldValue, newValue) == 0) { result.add(Pair.of(oldValue, newValue)); } } } return result; }  @SuppressWarnings({ "rawtypes", "unchecked" }) static Collection<Pair<T, T>> intersection(
			Collection<T> oldList, Collection<T> newList,
			java.util.Comparator comparator); @SuppressWarnings({ "rawtypes", "unchecked" }) static Collection<T> substract(Collection<T> oldList,
			Collection<T> newList, java.util.Comparator comparator);  }### Answer:
@Test(groups = { "collectionUtil" }, description = "intersect") public void testIntersect() throws Exception { Collection<String> a = new ArrayList<String>(); a.add("a"); a.add("b"); a.add("c"); a.add("d"); Collection<String> b = new ArrayList<String>(); b.add("A"); b.add("D"); b.add("E"); b.add("F"); Collection<Pair<String, String>> c = CollectionUtil.intersection(a, b, new StringComparator()); Assert.assertEquals(c.size(), 2, "collection size"); Assert.assertTrue(c.contains(new Pair<String, String>("a", "A")), "collection should contain pair"); Assert.assertTrue(c.contains(new Pair<String, String>("d", "D")), "collection should contain pair"); }