Java tutorial
//package com.java2s; //License from project: LGPL import java.util.Arrays; import java.util.List; public class Main { public static <E> List<E> intersection(List<E> list1, List<E> list2) { list1.retainAll(list2); return list1; } public static <E> List<E> intersection(E[] array1, E[] array2) { return intersection(Arrays.asList(array1), Arrays.asList(array2)); } }