filterNotNullTo
Appends all elements that are not null to the given destination.
@IgnorableReturnValuefun <C : MutableCollection<in T>, T : Any> Array<out T?>.filterNotNullTo(destination: C): C(source)
val nullableInts: Array<Int?> = arrayOf(1, null, 2, null, 3)
val nonNullList = mutableListOf<Int>()
nullableInts.filterNotNullTo(nonNullList)
println(nonNullList) // Output: [1, 2, 3]