filterTo
inline fun <T, C : MutableCollection<in T>> Iterable<T>.filterTo(destination: C, predicate: (T) -> Boolean): C(source)
Appends matching elements to destination in iteration order.
Tests every element once and appends those accepted by predicate. Existing destination contents are retained. If iteration, the callback or insertion fails, prior additions remain; the function does not roll them back. The inline callback supports non-local returns. An empty source leaves the destination unchanged.
Receiver
elements to visit in their iteration order.
Return
the same destination instance.
Parameters
destination
mutable collection receiving additions; its insertion rules apply.
predicate
test returning true to append the current element.