add

open override fun add(element: T): Boolean(source)

Appends element to the end of this list, growing the backing array when needed.

Duplicates are allowed. Successful insertion invalidates existing iterators.

Return

true after the element has been added.

Parameters

element

element to append.

Throws


open override fun add(index: Int, element: T)(source)

Inserts element at index, shifting following elements one position to the right.

An index equal to size appends to the list. Successful insertion invalidates existing iterators.

Parameters

index

insertion position, from zero through size inclusive.

element

element to insert.

Throws

if index is outside the insertion range or size is Int.MAX_VALUE.