lastIndex

val <T> Array<out T>.lastIndex: Int(source)

Returns the last valid index for the array.

Since Kotlin

1.0

Returns the last valid index for the array.

Since Kotlin

1.3

Returns the index of the last item in the list or -1 if the list is empty.

Since Kotlin

1.0

Samples