equals method

bool equals(
  1. CustomSet<T> other
)

Checks if this set is equal to other.

Notation: A = B

Two sets are equal if they contain exactly the same elements. Order does not matter, and duplicates are ignored.

Example:

final a = CustomSet<int>([1, 2, 3]);
final b = CustomSet<int>([3, 2, 1]);
print(a.equals(b)); // Output: true

Implementation

bool equals(CustomSet<T> other) =>
    cardinality == other.cardinality && isSubsetOf(other);