class ArrayList
source · line 5public class ArrayList<T> public constructor(initialCapacity: Long = 0L) : MutableList<T>
- Supertype
MutableList<T>
A growable indexed list. Appending grows storage geometrically; insertion and removal shift later elements. Clearing releases references in occupied slots.
constructor constructor
source · line 5constructor(initialCapacity: Long = 0L)
parameter initialCapacity
source · line 5initialCapacity: Long = 0L
property size
source · line 13public override val size: Long
- Overrides
size
get: public read-only
The current number of element slots visible through the list interface.
getter get
source · line 13get(): Long
function iterator
source · line 175public override operator fun iterator(): Iterator<T>
- Overrides
iterator· Iterable
Traverses the elements in index order and remains exhausted after reaching the end.
function toMutableArray
source · line 158public fun toMutableArray(): MutableArray<T>
Copies the initialized elements into independent mutable array slots.
function removeAt
source · line 110public override fun removeAt(index: Long): T
- Overrides
removeAt· MutableList
Removes and returns the indexed element, shifts later elements, and releases the vacated slot.
parameter index
source · line 110index: Long
function set
source · line 70public override operator fun set(index: Long, value: T): Unit
Replaces an existing element; out-of-range indices throw IndexOutOfBoundsException.
parameter value
source · line 70value: T
parameter index
source · line 70index: Long
function get
source · line 59public override operator fun get(index: Long): T
Reads the element at a zero-based index; out-of-range indices throw IndexOutOfBoundsException.
parameter index
source · line 59index: Long
function add
source · line 79public override fun add(value: T): Unit
- Overrides
add· MutableList
Appends an element or inserts it at the supplied index. Indexed insertion shifts later elements.
parameter value
source · line 79value: T
function toArray
source · line 143public fun toArray(): Array<T>
Copies the initialized elements into independent immutable array slots.
function clear
source · line 131public override fun clear(): Unit
- Overrides
clear· MutableList
Releases all occupied element slots and sets the size to zero.
type parameter T
source · line 5T
function add
source · line 90public override fun add(index: Long, value: T): Unit
- Overrides
add· MutableList
Appends an element or inserts it at the supplied index. Indexed insertion shifts later elements.
parameter value
source · line 90value: T
parameter index
source · line 90index: Long