Here you can find the source of Intersection(List
private static List<Integer> Intersection(List<Integer> a, List<Integer> b)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { private static List<Integer> Intersection(List<Integer> a, List<Integer> b) { // TODO Auto-generated method stub List<Integer> C = new ArrayList<Integer>(); for (Integer i : a) { if (b.contains(i)) { C.add(i);/* ww w . jav a2 s . com*/ } } return C; } }