Here you can find the source of intersectInto(C into, Collection
public static <T extends Object, C extends Collection<T>> C intersectInto(C into, Collection<T>... from)
//package com.java2s; import java.util.*; public class Main { public static <T extends Object, C extends Collection<T>> C intersectInto(C into, Collection<T>... from) { if (from.length > 0) { into.addAll(from[0]);/*from w w w . ja v a2 s. co m*/ for (int i = 1; i < from.length; i++) { into.retainAll(from[i]); } } return into; } }