isProperSubsetOf method

bool isProperSubsetOf(
  1. CustomSet<T> other
)

Checks if this set is a proper subset of other.

Notation: A ⊂ B

Returns true if this set is a subset of other and not equal to other. At least one element must exist in other that is not in this set.

Example:

final a = CustomSet<int>([1, 2, 3]);
final b = CustomSet<int>([1, 2, 3]);
final c = CustomSet<int>([1, 2, 3, 4]);
print(a.isProperSubsetOf(b)); // Output: false (equal sets)
print(a.isProperSubsetOf(c)); // Output: true

Implementation

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