ArrayList

class ArrayList<T>(initialCapacity: Int = 10) : MutableList<T> (source)

A mutable list backed by an array whose capacity grows as elements are added.

Constructors

Link copied to clipboard
constructor(initialCapacity: Int = 10)

Properties

Link copied to clipboard
open override val isEmpty: Boolean
Link copied to clipboard
open override var size: Int

Functions

Link copied to clipboard
open override fun add(element: T): Boolean
open override fun add(index: Int, element: T)
Link copied to clipboard
abstract fun addAll(p0: Collection<out T?>?): Boolean
abstract fun addAll(p0: Int, p1: Collection<out T?>?): Boolean
Link copied to clipboard
inline fun <T> Iterable<T>.all(predicate: (T) -> Boolean): Boolean

Returns true when every element matches predicate.

Link copied to clipboard
inline fun <T> Iterable<T>.any(predicate: (T) -> Boolean): Boolean

Returns true when at least one element matches predicate.

Link copied to clipboard
open override fun clear()
Link copied to clipboard
open operator override fun contains(element: T): Boolean
Link copied to clipboard
operator fun <T> Iterable<T>.contains(element: T): Boolean

Checks whether this iterable has an element equal to element.

Link copied to clipboard
abstract fun containsAll(p0: Collection<*>?): Boolean
Link copied to clipboard
inline fun <T> Iterable<T>.filter(predicate: (T) -> Boolean): List<T>

Returns a list containing elements matching predicate, in their original iteration order.

Link copied to clipboard

Returns a list of non-null elements in their original iteration order.

Link copied to clipboard
inline fun <T, C : MutableCollection<in T>> Iterable<T>.filterTo(destination: C, predicate: (T) -> Boolean): C

Appends matching elements to destination in iteration order and returns that destination.

Link copied to clipboard
inline fun <T> Iterable<T>.find(predicate: (T) -> Boolean): T?

Returns the first matching element, or null when no element matches predicate.

Link copied to clipboard
fun <T> Iterable<T>.first(): T

Returns the first element, throwing NoSuchElementException when empty.

inline fun <T> Iterable<T>.first(predicate: (T) -> Boolean): T

Returns the first matching element, throwing NoSuchElementException when no element matches.

Link copied to clipboard
fun <T> Iterable<T>.firstOrNull(): T?

Returns the first element, or null when this iterable is empty.

fun <T> List<T>.firstOrNull(): T?

Returns the first element, or null when this list is empty.

inline fun <T> Iterable<T>.firstOrNull(predicate: (T) -> Boolean): T?

Returns the first matching element, or null when no element matches predicate.

Link copied to clipboard
inline fun <T, R> Iterable<T>.fold(initial: R, operation: (R, T) -> R): R

Accumulates elements in iteration order, passing the current result and each element to operation. Returns initial unchanged when this iterable is empty.

Link copied to clipboard
inline fun <T> Iterable<T>.forEach(action: (T) -> Unit)

Calls action for each element in iteration order.

Link copied to clipboard
inline fun <T> Iterable<T>.forEachIndexed(action: (Int, T) -> Unit)

Calls action for each element and its zero-based index in iteration order.

Link copied to clipboard
open operator override fun get(index: Int): T
Link copied to clipboard
fun <T> List<T>.getOrNull(index: Int): T?

Returns the element at index, or null when the index is outside this list.

Link copied to clipboard
open override fun indexOf(element: T): Int
Link copied to clipboard
fun <T> Iterable<T>.indexOf(element: T): Int

Returns the index of the first equal element, or -1 when no element matches.

Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard

Checks whether this collection has at least one element.

Link copied to clipboard
open operator override fun iterator(): MutableIterator<T>
Link copied to clipboard
open override fun lastIndexOf(element: T): Int
Link copied to clipboard
fun <T> Iterable<T>.lastIndexOf(element: T): Int

Returns the index of the last equal element, or -1 when no element matches.

Link copied to clipboard
fun <T> Iterable<T>.lastOrNull(): T?

Returns the last element, or null when this iterable is empty.

fun <T> List<T>.lastOrNull(): T?

Returns the last element, or null when this list is empty.

inline fun <T> Iterable<T>.lastOrNull(predicate: (T) -> Boolean): T?

Returns the last matching element after traversing this iterable in iteration order.

inline fun <T> List<T>.lastOrNull(predicate: (T) -> Boolean): T?

Returns the last matching element, searching from the end until a match is found.

Link copied to clipboard
abstract fun listIterator(): ListIterator<T?>?
abstract fun listIterator(p0: Int): ListIterator<T?>?
Link copied to clipboard
inline fun <T, R> Collection<T>.map(transform: (T) -> R): List<R>

Maps a collection in iteration order, reserving its known size for the result.

inline fun <T, R> Iterable<T>.map(transform: (T) -> R): List<R>

Returns a list containing transform applied once to each element in iteration order.

Link copied to clipboard
inline fun <T, R : Any> Iterable<T>.mapNotNull(transform: (T) -> R?): List<R>

Applies transform once per element in iteration order and retains only non-null results.

Link copied to clipboard
inline fun <T, R : Any, C : MutableCollection<in R>> Iterable<T>.mapNotNullTo(destination: C, transform: (T) -> R?): C

Appends non-null transformed elements to destination and returns that destination.

Link copied to clipboard
inline fun <T, R, C : MutableCollection<in R>> Iterable<T>.mapTo(destination: C, transform: (T) -> R): C

Appends transformed elements to destination in iteration order and returns that destination.

Link copied to clipboard
inline fun <T> Iterable<T>.none(predicate: (T) -> Boolean): Boolean

Returns true when no element matches predicate.

Link copied to clipboard
open override fun remove(element: T): Boolean
Link copied to clipboard
abstract fun removeAll(p0: Collection<*>?): Boolean
Link copied to clipboard
open override fun removeAt(index: Int): T
Link copied to clipboard
abstract fun retainAll(p0: Collection<*>?): Boolean
Link copied to clipboard
open operator override fun set(index: Int, element: T): T
Link copied to clipboard
abstract fun subList(p0: Int, p1: Int): List<T?>?