Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; public class Main { public static List intersect(List srcList, List destList) { List list = new ArrayList<>(Arrays.asList(new Object[srcList.size()])); Collections.copy(list, srcList); list.retainAll(destList); return list; } }