W3cubDocs

/Kotlin

elementAtOrNull

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

Returns an element at the given index or null if the index is out of bounds of this array.

fun <T> Iterable<T>.elementAtOrNull(index: Int): T?

Returns an element at the given index or null if the index is out of bounds of this collection.

inline fun <T> List<T>.elementAtOrNull(index: Int): T?

Returns an element at the given index or null if the index is out of bounds of this list.

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