Home / Docs / Standard library / Built-in methods
union
Release v0.4.0Edition 0.5 preview
A built-in method, resolved by the type of its receiver (spec/14 §2). Edition 0.5 preview.
una
s.union(other: Set[T]) -> Set[T]
where s: Set[T]
s.union(other: HashSet[T]) -> HashSet[T]
where s: HashSet[T]
b.union(other: BitSet) -> BitSet
where b: BitSetThe items of s and those of other. O(n + m), or less when other is much smaller (spec/28 §6). On a HashSet, the receiver's items, then the other's it lacks, in the other's order (spec/28 §7). On a BitSet, other has its size, in O(size / 64) (spec/28 §9).
Specification
spec/28 §6spec/28 §7spec/28 §9
Generated from una v0.4.0 (docs/std/builtins.json, which is not part of the specification): built-in methods have no declaration, so una writes these signature lines and tests each against its checker. The specification governs: spec/14 §2.