isDisjointFrom method

bool isDisjointFrom(
  1. CustomSet<T> other
)

Checks if this set is disjoint from other.

Notation: A // B

Two sets are disjoint if they have no elements in common. Their intersection is the empty set.

Example:

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

Implementation

bool isDisjointFrom(CustomSet<T> other) =>
    _elements.every((e) => !other._elements.contains(e));