Java tutorial
//package com.java2s; import java.util.Collection; import java.util.HashSet; public class Main { public static boolean collectionsMatch(Collection<?> coll1, Collection<?> coll2) { if (coll1 == null && coll2 == null) { return true; } else if (coll1 != null && coll2 != null) { return new HashSet<>(coll1).equals(new HashSet<>(coll2)); } else { return false; } } }