indexOf

Common
JVM
JS
Native
1.0
fun <T> Array<out T>.indexOf(element: T): Int
(source)
fun ByteArray.indexOf(element: Byte): Int
(source)
fun ShortArray.indexOf(element: Short): Int
(source)
fun IntArray.indexOf(element: Int): Int
(source)
fun LongArray.indexOf(element: Long): Int
(source)
@DeprecatedSinceKotlin("1.4", "1.6", "1.7") fun FloatArray.indexOf(
    element: Float
): Int

(source)
Deprecated: The function has unclear behavior when searching for NaN or zero values and will be removed soon. Use 'indexOfFirst { it == element }' instead to continue using this behavior, or '.asList().indexOf(element: T)' to get the same search behavior as in a list.
@DeprecatedSinceKotlin("1.4", "1.6", "1.7") fun DoubleArray.indexOf(
    element: Double
): Int

(source)
Deprecated: The function has unclear behavior when searching for NaN or zero values and will be removed soon. Use 'indexOfFirst { it == element }' instead to continue using this behavior, or '.asList().indexOf(element: T)' to get the same search behavior as in a list.
fun BooleanArray.indexOf(element: Boolean): Int
(source)
fun CharArray.indexOf(element: Char): Int
(source)
@ExperimentalUnsignedTypes fun UIntArray.indexOf(
    element: UInt
): Int

(source)
@ExperimentalUnsignedTypes fun ULongArray.indexOf(
    element: ULong
): Int

(source)
@ExperimentalUnsignedTypes fun UByteArray.indexOf(
    element: UByte
): Int

(source)
@ExperimentalUnsignedTypes fun UShortArray.indexOf(
    element: UShort
): Int

(source)

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

Common
JVM
JS
Native
1.0
fun <T> Iterable<T>.indexOf(element: T): Int
(source)

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

Common
JVM
JS
Native
1.0
fun <T> List<T>.indexOf(element: T): Int
(source)

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