Here you can find the source of containSameItems(Collection c1, Collection c2)
public static boolean containSameItems(Collection c1, Collection c2)
//package com.java2s; import java.util.*; public class Main { public static boolean containSameItems(Collection c1, Collection c2) { Set s1 = (c1 instanceof Set) ? (Set) c1 : new HashSet(c1); Set s2 = (c2 instanceof Set) ? (Set) c2 : new HashSet(c2); return s1.equals(s2); }//from w ww. j a v a2s . c om }