BoxSetAddAll
Add every element of a collection into a Set, deduplicating automatically.
The source collection can be an Array, another Set, a list-delimited String, or any value castable to a Set. The Set is modified in place and returned to support method chaining.
Method Signature
BoxSetAddAll(set=[modifiableSet], values=[any])Arguments
Argument
Type
Required
Description
Default
set
modifiableSet
true
The set to add to.
values
any
true
The collection of values to add. Accepts an Array, Set, list-delimited String, or any castable collection.
Examples
Add all elements from another collection
Accepts an Array, another Set, or any iterable. Duplicates are silently ignored.
s = [ 1, 2, 3 ].toSet();
s.addAll( [ 4, 5 ] );
writeOutput( s.size() );
Result: 5
Merge two Sets
Result: 3
Related
Last updated
Was this helpful?
