filterTo

Appends all elements matching the given predicate to the given destination.

@IgnorableReturnValueinline fun <T, C : MutableCollection<in T>> Array<out T>.filterTo(destination: C, predicate: (T) -> Boolean): C(source)
val words = arrayOf("apple", "banana", "avocado", "cherry")
val aWords = mutableListOf<String>()

words.filterTo(aWords) { it.startsWith("a") }

println(aWords)  // [apple, avocado]

Source