KtList<T> class

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 KtMutableList interface. @param T the type of elements contained in the list. The list is covariant on its element type.

Implemented types
Implementers
Available Extensions

Constructors

KtList.empty()
Returns an empty read-only list.
factory
KtList.from([@nonNull Iterable<T> elements = const []])
Returns a new read-only list based on elements.
factory
KtList.of([T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6, T arg7, T arg8, T arg9])
Returns a new read-only list of given elements. [...]
factory

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
iter Iterable<T>
Access to a Iterable to be used in for-loops
read-only, inherited
list List<T>
Deprecated, use asList or iter for loops
@Deprecated("use asList() or iter instead"), read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
size int
Returns the size of the collection.
read-only, override

Methods

asList() List<T>
Returns a read-only dart:core List [...]
contains(T element) bool
Checks if the specified element is contained in this collection.
override
containsAll(KtCollection<T> elements) bool
Checks if all elements in the specified collection are contained in this collection.
override
get(int index) → T
Returns the element at the specified index in the list or throw IndexOutOfBoundsException
@nullable
indexOf(T element) 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.
isEmpty() bool
Returns true if the collection is empty (contains no elements), false otherwise.
override
iterator() KtIterator<T>
Returns an iterator over the elements of this object.
override
lastIndexOf(T element) 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.
listIterator([int index = 0]) KtListIterator<T>
Returns a list iterator over the elements in this list (in proper sequence), starting at the specified index or 0 by default.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
subList(int fromIndex, int toIndex) KtList<T>
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. [...]
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited
operator [](int index) → T
Returns the element at the specified index in the list or throw IndexOutOfBoundsException
@nullable