/**
* Computes the set union `(`self` + `that`)` between this `HashSet` and the
* specified `Iterable`.
*
* **NOTE**: the hash and equal of the values in both the set and the iterable
* must be the same.
*
* @tsplus static HashSet.Aspects union
* @tsplus pipeable HashSet union
*/
export function union(that: Iterable) {
return (self: HashSet): HashSet => {
const set = HashSet.empty()
return set.mutate((_) => {
self.forEach((a) => {
_.add(a)
})
for (const a of that) {
_.add(a)
}
})
}
}