setsEqual function

bool setsEqual (Set a, Set b)

Checks Sets a and b for equality.

Returns true if a and b are both null, or they are the same length and every element in b exists in a.

Implementation

bool setsEqual(Set a, Set b) {
  if (a == b) return true;
  if (a == null || b == null) return false;
  if (a.length != b.length) return false;

  return a.containsAll(b);
}