W3cubDocs

/Kotlin

indexOfFirst

inline fun <T> Array<out T>.indexOfFirst(
    predicate: (T) -> Boolean
): Int
inline fun ByteArray.indexOfFirst(
    predicate: (Byte) -> Boolean
): Int
inline fun ShortArray.indexOfFirst(
    predicate: (Short) -> Boolean
): Int
inline fun IntArray.indexOfFirst(
    predicate: (Int) -> Boolean
): Int
inline fun LongArray.indexOfFirst(
    predicate: (Long) -> Boolean
): Int
inline fun FloatArray.indexOfFirst(
    predicate: (Float) -> Boolean
): Int
inline fun DoubleArray.indexOfFirst(
    predicate: (Double) -> Boolean
): Int
inline fun BooleanArray.indexOfFirst(
    predicate: (Boolean) -> Boolean
): Int
inline fun CharArray.indexOfFirst(
    predicate: (Char) -> Boolean
): Int

Returns index of the first element matching the given predicate, or -1 if the array does not contain such element.

inline fun <T> Iterable<T>.indexOfFirst(
    predicate: (T) -> Boolean
): Int

Returns index of the first element matching the given predicate, or -1 if the collection does not contain such element.

inline fun <T> List<T>.indexOfFirst(
    predicate: (T) -> Boolean
): Int

Returns index of the first element matching the given predicate, or -1 if the list does not contain such element.

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