Java tutorial
//package com.java2s; import java.util.List; public class Main { /** * If there are an equal amount of items in both sets and every string in a is contained in b, the sets are equal. * * @param a First list. * @param b Second list. * @return True if sets are equal, false if not. */ protected static boolean areSetsEqual(List<String> a, List<String> b) { // If size is not equal, sets cannot be equal. if (a.size() != b.size()) return false; // If every element of a is contained in b, then sets are equal. boolean equal = true; for (String s : a) { if (!b.contains(s)) { equal = false; break; } } return equal; } }