Java tutorial
//package com.java2s; import java.util.List; public class Main { public static boolean containsAllAndOnly(List<?> c1, List<?> c2) { if (c1 == null || c2 == null) return false; if (c1.size() != c2.size()) return false; if (!c1.containsAll(c2)) return false; return true; } }