complement<T> static method
Returns the complement of a set with respect to a universal set.
Notation: A' or A̅ = {x | x ∈ U and x ∉ A}
The complement contains all elements in the universal set that are not in the given set.
Example:
final universal = CustomSet<int>([1, 2, 3, 4, 5, 6, 7, 8, 9]);
final a = CustomSet<int>([1, 3, 7, 9]);
final result = SetOperations.complement(a, universal);
// result = {2, 4, 6, 8}
Implementation
static CustomSet<T> complement<T>(CustomSet<T> a, CustomSet<T> universal) =>
CustomSet(universal.elements.where((e) => !a.contains(e)));