Here you can find the source of contains(Collection
public static <T> boolean contains(Collection<T> c1, Collection<T> c2)
//package com.java2s; import java.util.Collection; public class Main { public static <T> boolean contains(Collection<T> c1, Collection<T> c2) { boolean flag = true; for (T t : c2) { if (!c1.contains(t)) { flag = false;//from w ww.j a v a 2 s . co m break; } } return flag; } }