KtListExtensions<T> extension

on

Properties

dart List<T>
Returns a read-only dart:core List
no setter
lastIndex int
Returns the index of the last item in the list or -1 if the list is empty.
no setter

Methods

cast<R>() KtList<R>
Provides a view of this KtList as an list of R instances.
dropLast(int n) KtList<T>
Returns a list containing all elements except last n elements.
dropLastWhile(bool predicate(T)) KtList<T>
Returns a list containing all elements except last elements that satisfy the given predicate.
elementAt(int index) → T
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this list.
elementAtOrElse(int index, T defaultValue(int index)) → T
Returns an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this list.
elementAtOrNull(int index) → T?
Returns an element at the given index or null if the index is out of bounds of this collection.
first([bool predicate(T)?]) → T
Returns first element.
foldRight<R>(R initial, R operation(T, R acc)) → R
Accumulates value starting with initial value and applying operation from right to left to each element and current accumulator value.
foldRightIndexed<R>(R initial, R operation(int index, T, R acc)) → R
Accumulates value starting with initial value and applying operation from right to left to each element with its index in the original list and current accumulator value. @param operation function that takes the index of an element, the element itself and current accumulator value, and calculates the next accumulator value.
getOrElse(int index, T defaultValue(int)) → T
Returns an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this list.
getOrNull(int index) → T?
Returns an element at the given index or null if the index is out of bounds of this list.
last([bool predicate(T)?]) → T
Returns the last element matching the given predicate. @throws NoSuchElementException if no such element is found.
reduceRight<S>(S operation(T, S acc)) → S
Accumulates value starting with last element and applying operation from right to left to each element and current accumulator value.
reduceRightIndexed<S>(S operation(int index, T, S acc)) → S
Accumulates value starting with last element and applying operation from right to left to each element with its index in the original list and current accumulator value. @param operation function that takes the index of an element, the element itself and current accumulator value, and calculates the next accumulator value.
single([bool predicate(T)?]) → T
Returns the single element matching the given predicate, or throws an exception if the list is empty or has more than one element.
singleOrNull([bool predicate(T)?]) → T?
Returns the single element matching the given predicate, or null if element was not found or more than one element was found.
slice(KtIterable<int> indices) KtList<T>
Returns a list containing elements at specified indices.
takeLast(int n) KtList<T>
Returns a list containing last n elements.
takeLastWhile(bool predicate(T)) KtList<T>
Returns a list containing last elements satisfying the given predicate.