kotlin.collections.List API Reference
Kotlin's List<T> — an immutable ordered collection; MutableList<T> adds in-place mutation.
List<T>
A generic ordered collection of elements. List is read-only; MutableList supports modification.
List.size: IntReturns the number of elements in this collection.
Returns: Int
MutableList.add(element: E): BooleanAdds the specified element to the end of this list. Returns true.
Returns: Boolean
MutableList.remove(element: E): BooleanRemoves the first occurrence of the specified element. Returns true if removed.
Returns: Boolean
List.contains(element: E): BooleanReturns true if element is found in the collection.
Returns: Boolean
List.map { it -> R }: List<R>Returns a list containing the results of applying transform to each element.
Returns: List<R>
List.filter { it -> Boolean }: List<E>Returns a list containing only elements matching the given predicate.
Returns: List<E>
List.sorted(): List<E>Returns a new list with all elements sorted ascending according to their natural order.
Returns: List<E>
List.forEach { it -> Unit }Performs the given action on each element in order.
Returns: Unit