@Test @SuppressWarnings("unchecked") public void intersection() { final List<Integer> result = Intersection.intersection(asList(1, 2, 3), asList(101, 2, 1, 10), asList(2, 1)); assertEquals("[1, 2]", result.toString()); }
public static <E> List<E> intersection(final List<E> list1, final List<E> list2) { return filter(list1, new Predicate<E>() { @Override public boolean test(E elem) { return contains(list2, elem); } }); }
Intersection { public static <E> List<E> intersection(final List<E> list1, final List<E> list2) { return filter(list1, new Predicate<E>() { @Override public boolean test(E elem) { return contains(list2, elem); } }); } }
Intersection { public static <E> List<E> intersection(final List<E> list1, final List<E> list2) { return filter(list1, new Predicate<E>() { @Override public boolean test(E elem) { return contains(list2, elem); } }); }  }
Intersection { public static <E> List<E> intersection(final List<E> list1, final List<E> list2) { return filter(list1, new Predicate<E>() { @Override public boolean test(E elem) { return contains(list2, elem); } }); }  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> intersection(final List<E> list1, final List<E> list2); @SuppressWarnings("unchecked") static List<E> intersection(final List<E> list, final List<E> ... lists); }
Intersection { public static <E> List<E> intersection(final List<E> list1, final List<E> list2) { return filter(list1, new Predicate<E>() { @Override public boolean test(E elem) { return contains(list2, elem); } }); }  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> intersection(final List<E> list1, final List<E> list2); @SuppressWarnings("unchecked") static List<E> intersection(final List<E> list, final List<E> ... lists);  }