List

interface List<out E> : Collection<E> (source)

A generic ordered collection of elements. Methods in this interface support only read-only access to the list; read/write access is supported through the MutableList interface.

Since Kotlin

1.0

Parameters

E

the type of elements contained in the list. The list is covariant in its element type.

Functions

Link copied to clipboard
abstract operator override fun contains(element: @UnsafeVariance E): Boolean

Checks if the specified element is contained in this collection.

Since Kotlin 1.0
Link copied to clipboard
abstract override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean

Checks if all elements in the specified collection are contained in this collection.

Since Kotlin 1.0
Link copied to clipboard
abstract operator fun get(index: Int): E

Returns the element at the specified index in the list.

Since Kotlin 1.0
Link copied to clipboard
abstract fun indexOf(element: @UnsafeVariance E): Int

Returns the index of the first occurrence of the specified element in the list, or -1 if the specified element is not contained in the list.

Since Kotlin 1.0
Link copied to clipboard
abstract override fun isEmpty(): Boolean

Returns true if the collection is empty (contains no elements), false otherwise.

Since Kotlin 1.0
Link copied to clipboard
abstract operator override fun iterator(): Iterator<E>

Returns an iterator over the elements of this object.

Since Kotlin 1.0
Link copied to clipboard
abstract fun lastIndexOf(element: @UnsafeVariance E): Int

Returns the index of the last occurrence of the specified element in the list, or -1 if the specified element is not contained in the list.

Since Kotlin 1.0
Link copied to clipboard
abstract fun listIterator(): ListIterator<E>

Returns a list iterator over the elements in this list (in proper sequence).

Since Kotlin 1.0
abstract fun listIterator(index: Int): ListIterator<E>

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified index.

Since Kotlin 1.0
Link copied to clipboard
abstract fun subList(fromIndex: Int, toIndex: Int): List<E>

Returns a view of the portion of this list between the specified fromIndex (inclusive) and toIndex (exclusive). The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa.

Since Kotlin 1.0

Properties

Link copied to clipboard
abstract override val size: Int

Returns the size of the collection.

Since Kotlin 1.0

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun <R> Iterable<*>.filterIsInstance(klass: Class<R>): List<R>

Returns a list containing all elements that are instances of specified class.

Since Kotlin 1.0
Link copied to clipboard
fun <C : MutableCollection<in R>, R> Iterable<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C

Appends all elements that are instances of specified class to the given destination.

Since Kotlin 1.0
Link copied to clipboard
fun <T : Comparable<T>> Iterable<T>.max(): T?
Since Kotlin 1.0
Link copied to clipboard
inline fun <T, R : Comparable<R>> Iterable<T>.maxBy(selector: (T) -> R): T?
Since Kotlin 1.0
Link copied to clipboard
fun <T> Iterable<T>.maxWith(comparator: Comparator<in T>): T?
Since Kotlin 1.0
Link copied to clipboard
fun <T : Comparable<T>> Iterable<T>.min(): T?
Since Kotlin 1.0
Link copied to clipboard
inline fun <T, R : Comparable<R>> Iterable<T>.minBy(selector: (T) -> R): T?
Since Kotlin 1.0
Link copied to clipboard
fun <T> Iterable<T>.minWith(comparator: Comparator<in T>): T?
Since Kotlin 1.0
Link copied to clipboard
fun <T> Iterable<T>.toSortedSet(comparator: Comparator<in T>): SortedSet<T>

Returns a new SortedSet of all elements.

Since Kotlin 1.0
Link copied to clipboard
actual inline fun <T> Collection<T>.toTypedArray(): Array<T>

Returns a typed array containing all of the elements of this collection.

Since Kotlin 1.0