isSubsetOf method

bool isSubsetOf(
  1. CustomSet<T> other
)

Checks if this set is a subset of other.

Notation: A ⊆ B

Returns true if every element of this set is also in other. An empty set is a subset of any set.

Example:

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

Implementation

bool isSubsetOf(CustomSet<T> other) =>
    _elements.every(other._elements.contains);