r4zzz4k
12/08/2017, 7:25 PMpublic inline fun <T> Iterable<T>.filter(predicate: (T) -> Boolean): List<T> {
return filterTo(ArrayList<T>(), predicate)
}
https://github.com/JetBrains/kotlin/blob/1.2.0/libraries/stdlib/src/generated/_Collections.kt#L688
public inline fun <T, C : MutableCollection<in T>> Iterable<T>.filterTo(destination: C, predicate: (T) -> Boolean): C {
for (element in this) if (predicate(element)) destination.add(element)
return destination
}
To me seems nearly the same to what you've done with several minor differences.