elementAt
fun
<
T
>
Array
<
out
T
>
.
elementAt
(
index
:
Int
)
:
T
(Common source) (JVM source) (JS source) (Native source)
fun
ByteArray
.
elementAt
(
index
:
Int
)
:
Byte
(Common source) (JVM source) (JS source) (Native source)
fun
ShortArray
.
elementAt
(
index
:
Int
)
:
Short
(Common source) (JVM source) (JS source) (Native source)
fun
IntArray
.
elementAt
(
index
:
Int
)
:
Int
(Common source) (JVM source) (JS source) (Native source)
fun
LongArray
.
elementAt
(
index
:
Int
)
:
Long
(Common source) (JVM source) (JS source) (Native source)
fun
FloatArray
.
elementAt
(
index
:
Int
)
:
Float
(Common source) (JVM source) (JS source) (Native source)
fun
DoubleArray
.
elementAt
(
index
:
Int
)
:
Double
(Common source) (JVM source) (JS source) (Native source)
fun
BooleanArray
.
elementAt
(
index
:
Int
)
:
Boolean
(Common source) (JVM source) (JS source) (Native source)
fun
CharArray
.
elementAt
(
index
:
Int
)
:
Char
(Common source) (JVM source) (JS source) (Native source)
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this array.
import kotlin.test.*
fun main(args: Array<String>) {
//sampleStart
val list = listOf(1, 2, 3)
println(list.elementAt(0)) // 1
println(list.elementAt(2)) // 3
// list.elementAt(3) // will fail with IndexOutOfBoundsException
val emptyList = emptyList<Int>()
// emptyList.elementAt(0) // will fail with IndexOutOfBoundsException
//sampleEnd
}
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this collection.
import kotlin.test.*
fun main(args: Array<String>) {
//sampleStart
val list = listOf(1, 2, 3)
println(list.elementAt(0)) // 1
println(list.elementAt(2)) // 3
// list.elementAt(3) // will fail with IndexOutOfBoundsException
val emptyList = emptyList<Int>()
// emptyList.elementAt(0) // will fail with IndexOutOfBoundsException
//sampleEnd
}
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this list.
import kotlin.test.*
fun main(args: Array<String>) {
//sampleStart
val list = listOf(1, 2, 3)
println(list.elementAt(0)) // 1
println(list.elementAt(2)) // 3
// list.elementAt(3) // will fail with IndexOutOfBoundsException
val emptyList = emptyList<Int>()
// emptyList.elementAt(0) // will fail with IndexOutOfBoundsException
//sampleEnd
}
@ExperimentalUnsignedTypes
fun
UIntArray
.
elementAt
(
index
:
Int
)
:
UInt
(Common source) (JVM source) (Native source)
@ExperimentalUnsignedTypes
fun
ULongArray
.
elementAt
(
index
:
Int
)
:
ULong
(Common source) (JVM source) (Native source)
@ExperimentalUnsignedTypes
fun
UByteArray
.
elementAt
(
index
:
Int
)
:
UByte
(Common source) (JVM source) (Native source)
@ExperimentalUnsignedTypes
fun
UShortArray
.
elementAt
(
index
:
Int
)
:
UShort
(Common source) (JVM source) (Native source)
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this array.
import kotlin.test.*
fun main(args: Array<String>) {
//sampleStart
val list = listOf(1, 2, 3)
println(list.elementAt(0)) // 1
println(list.elementAt(2)) // 3
// list.elementAt(3) // will fail with IndexOutOfBoundsException
val emptyList = emptyList<Int>()
// emptyList.elementAt(0) // will fail with IndexOutOfBoundsException
//sampleEnd
}
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this array.
import kotlin.test.*
fun main(args: Array<String>) {
//sampleStart
val list = listOf(1, 2, 3)
println(list.elementAt(0)) // 1
println(list.elementAt(2)) // 3
// list.elementAt(3) // will fail with IndexOutOfBoundsException
val emptyList = emptyList<Int>()
// emptyList.elementAt(0) // will fail with IndexOutOfBoundsException
//sampleEnd
}