union method
Returns the union of this set with other.
Notation: A ∪ B = {x | x ∈ A or x ∈ B}
The union contains all elements that are in either set or both.
Example:
final a = CustomSet<int>([2, 5, 8]);
final b = CustomSet<int>([7, 5, 22]);
final result = a.union(b);
// result = {2, 5, 7, 8, 22}
Implementation
CustomSet<T> union(CustomSet<T> other) =>
CustomSet({..._elements, ...other._elements});