isEquivalentTo method

bool isEquivalentTo(
  1. CustomSet<T> other
)

Checks if this set is equivalent to other.

Notation: A ~ B

Two sets are equivalent if they have the same cardinality. The actual elements do not need to be the same.

Example:

final a = CustomSet<int>([1, 2, 3, 4]);
final b = CustomSet<String>(['a', 'b', 'c', 'd']);
print(a.isEquivalentTo(b)); // Output: true

Implementation

bool isEquivalentTo(CustomSet<T> other) => cardinality == other.cardinality;