@UnstableApi
class LongArray


An append-only, auto-growing long[].

Summary

Public constructors

LongArray(initialCapacity: Int)

Public functions

Unit
add(value: Long)

Appends a value.

Long
get(index: Int)

Returns the value at a specified index.

Int

Returns the current size of the array.

LongArray<Long>!

Copies the current values into a newly allocated primitive array.

Public constructors

LongArray

LongArray()

LongArray

LongArray(initialCapacity: Int)
Parameters
initialCapacity: Int

The initial capacity of the array.

Public functions

add

fun add(value: Long): Unit

Appends a value.

Parameters
value: Long

The value to append.

get

fun get(index: Int): Long

Returns the value at a specified index.

Parameters
index: Int

The index.

Returns
Long

The corresponding value.

Throws
java.lang.IndexOutOfBoundsException

If the index is less than zero, or greater than or equal to size.

size

fun size(): Int

Returns the current size of the array.

toArray

fun toArray(): LongArray<Long>!

Copies the current values into a newly allocated primitive array.

Returns
LongArray<Long>!

The primitive array containing the copied values.