boolean (Collection<?> c1, Collection<?> c2) { if (c1 == null) { return c2 == null; } else if (c2 == null) { return false; } if (c1.size() != c2.size()) { return false; } HashSet<Object> set = new HashSet<>(c1); set.removeAll(c2); return (set.size() == 0); }