KtMutableList<T> class
abstract
A generic ordered collection of elements that supports adding and removing elements. @param E the type of elements contained in the list. The mutable list is invariant on its element type.
- Implemented types
-
- KtList<
T> - KtMutableCollection<
T>
- KtList<
- Available extensions
- ChainableKtIterableExtensions
- ChainableKtListExtensions
- KtCollectionExtensions
- KtComparableIterableExtension
- KtDoubleIterableExtension
- KtIntIterableExtension
- KtIterableExtensions
- KtListExtensions
- KtMutableIterableExtensions
- KtMutableListExtensions
- KtNumIterableExtension
- NestedKtIterableExtensions
- RequireNoNullsKtIterableExtension
- RequireNoNullsKtListExtension
- UnzipKtIterableExtensions
Constructors
- KtMutableList.empty()
-
factory
-
KtMutableList.from([Iterable<
T> elements = const []]) -
factory
- KtMutableList.of([T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6, T arg7, T arg8, T arg9])
-
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 setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
Returns the size of the collection.
no setterinherited
Methods
-
add(
T element) → bool -
Adds the specified element to the end of this list.
override
-
addAll(
KtIterable< T> elements) → bool -
Adds all of the elements of the specified collection to the end of this list.
override
-
addAllAt(
int index, KtCollection< T> elements) → bool -
Inserts all of the elements in the specified collection
elements
into this list at the specifiedindex
. -
addAt(
int index, T element) → void -
Inserts an element into the list at the specified
index
. -
asList(
) → List< T> -
Creates a List instance that wraps the original KtList. It acts as a view.
override
-
clear(
) → void -
Removes all elements from this collection.
override
-
contains(
T element) → bool -
Checks if the specified element is contained in this collection.
inherited
-
containsAll(
KtCollection< T> elements) → bool -
Checks if all elements in the specified collection are contained in this collection.
inherited
-
get(
int index) → T -
Returns the element at the specified index in the list or throw IndexOutOfBoundsException
inherited
-
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.
inherited
-
isEmpty(
) → bool -
Returns
true
if the collection is empty (contains no elements),false
otherwise.inherited -
iterator(
) → KtMutableIterator< T> -
Returns an iterator over the elements of this object.
inherited
-
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.
inherited
-
listIterator(
[int index = 0]) → KtMutableListIterator< T> -
Returns a list iterator over the elements in this list (in proper sequence), starting at the specified
index
or0
by default.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
T element) → bool -
Removes a single instance of the specified element from this
collection, if it is present.
override
-
removeAll(
KtIterable< T> elements) → bool -
Removes all of this collection's elements that are also contained in the specified collection.
override
-
removeAt(
int index) → T -
Removes and returns the element at the specified
index
from the list. -
retainAll(
KtIterable< T> elements) → bool -
Retains only the elements in this collection that are contained in the specified collection.
override
-
set(
int index, T element) → T - Replaces the element at the specified position in this list with the specified element.
-
subList(
int fromIndex, int toIndex) → KtMutableList< 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.override -
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
inherited
-
operator []=(
int index, T element) → void - Replaces the element at the specified position in this list with the specified element.