W3cubDocs

/Kotlin

filterIndexedTo

inline fun <T, C : MutableCollection<in T>> Array<out T>.filterIndexedTo(
    destination: C, 
    predicate: (index: Int, T) -> Boolean
): C
inline fun <C : MutableCollection<in Byte>> ByteArray.filterIndexedTo(
    destination: C, 
    predicate: (index: Int, Byte) -> Boolean
): C
inline fun <C : MutableCollection<in Short>> ShortArray.filterIndexedTo(
    destination: C, 
    predicate: (index: Int, Short) -> Boolean
): C
inline fun <C : MutableCollection<in Int>> IntArray.filterIndexedTo(
    destination: C, 
    predicate: (index: Int, Int) -> Boolean
): C
inline fun <C : MutableCollection<in Long>> LongArray.filterIndexedTo(
    destination: C, 
    predicate: (index: Int, Long) -> Boolean
): C
inline fun <C : MutableCollection<in Float>> FloatArray.filterIndexedTo(
    destination: C, 
    predicate: (index: Int, Float) -> Boolean
): C
inline fun <C : MutableCollection<in Double>> DoubleArray.filterIndexedTo(
    destination: C, 
    predicate: (index: Int, Double) -> Boolean
): C
inline fun <C : MutableCollection<in Boolean>> BooleanArray.filterIndexedTo(
    destination: C, 
    predicate: (index: Int, Boolean) -> Boolean
): C
inline fun <C : MutableCollection<in Char>> CharArray.filterIndexedTo(
    destination: C, 
    predicate: (index: Int, Char) -> Boolean
): C
inline fun <T, C : MutableCollection<in T>> Iterable<T>.filterIndexedTo(
    destination: C, 
    predicate: (index: Int, T) -> Boolean
): C

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

Parameters

predicate - function that takes the index of an element and the element itself and returns the result of predicate evaluation on the element.

© 2010–2018 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/filter-indexed-to.html