filter
Returns a list containing elements matching predicate, in their original iteration order.
Tests every element once and retains the accepted values without copying the values themselves. A nullable element can be retained by the predicate. Exceptions from iteration or the callback propagate to the caller. The inline callback supports non-local returns.
Receiver
elements to visit in their iteration order.
Return
a new read-only list of accepted elements; empty if none match.
Parameters
predicate
test returning true to retain the current element.