BoxSetRemoveAll
Remove every element of a collection from a Set, leaving only the elements that are not in the collection.
The Set is modified in place and returned to support method chaining. Elements not present in the Set are silently skipped.
Method Signature
BoxSetRemoveAll(set=[modifiableSet], values=[any])Arguments
Argument
Type
Required
Description
Default
set
modifiableSet
true
The set to remove from.
values
any
true
The collection of values to remove. Accepts an Array, Set, list-delimited String, or any castable collection.
Examples
Remove all elements found in another collection
Elements not present in the Set are silently ignored.
s = [ 1, 2, 3, 4, 5 ].toSet();
s.removeAll( [ 1, 2 ] );
writeOutput( s.size() );
Result: 3
Remove using another Set
Result: 2
Related
Last updated
Was this helpful?
