For the complete documentation index, see llms.txt. This page is also available as Markdown.

BoxSetReject

Return a new Set containing only the elements of the source Set for which the predicate returns false (the inverse of setFilter).

The result is a new Set of the same variant as the source; the source is not modified. The predicate receives the element value, its 1-based ordinal position, and the Set itself.

Method Signature

BoxSetReject(set=[set], callback=[function:Predicate])

Arguments

Argument
Type
Required
Description
Default

set

set

true

The set to filter.

callback

function:Predicate

true

Predicate invoked for each element. Receives {@code (value, ordinal, set)}. Elements for which this returns {@code false} are included in the result.

Examples

Return elements that do NOT satisfy a predicate

The complement of filter.

s = [ 1, 2, 3, 4, 5 ].toSet();
odds = s.reject( ( Any v ) => v % 2 == 0 );
writeOutput( odds.size() );

Result: 3

Reject short strings

Result: 2

Last updated

Was this helpful?