BoxSetUnion
Compute the union (A \u222a B) of two Sets, returning a new Set that contains all elements from both.
Duplicates are automatically deduplicated. The result is a new Set of the same variant as A; neither input is modified.
Method Signature
BoxSetUnion(set=[set], otherSet=[any])Arguments
Argument
Type
Required
Description
Default
set
set
true
The first set (A).
otherSet
any
true
The second set (B). Accepts any value castable to a Set.
Examples
Combine all elements from both Sets
a = [ 1, 2, 3 ].toSet();
b = [ 3, 4, 5 ].toSet();
u = a.union( b );
writeOutput( u.size() );
Result: 5
Using the + operator shorthand
Result: 5
Union with an Array (right-hand operand is accepted as-is)
Result: 5
Related
Last updated
Was this helpful?
