KtList<T> class
abstract
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
-
- KtCollection<
T>
- KtCollection<
- Implementers
- Available extensions
- ChainableKtIterableExtensions
- ChainableKtListExtensions
- KtCollectionExtensions
- KtComparableIterableExtension
- KtDoubleIterableExtension
- KtIntIterableExtension
- KtIterableExtensions
- KtListExtensions
- KtNumIterableExtension
- NestedKtIterableExtensions
- RequireNoNullsKtIterableExtension
- RequireNoNullsKtListExtension
- UnzipKtIterableExtensions
Constructors
- KtList.empty()
-
Returns an empty read-only list.
constfactory
-
KtList.from([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.
no setterinherited
-
iter
→ Iterable<
T> -
Access to a Iterable to be used in for-loops
no setterinherited
-
list
→ List<
T> -
Deprecated, use asList or iter for loops
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
Returns the size of the collection.
no setteroverride
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
-
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
or0
by default. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent 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) andtoIndex
(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 -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → T - Returns the element at the specified index in the list or throw IndexOutOfBoundsException