ObjListNullExt<E> extension
Properties
-
first
← E
-
The first element of the list.
no getter
-
last
← E
-
The last element of the list.
no getter
-
length
↔ int
-
The number of objects in this list.
getter/setter pair
-
reversed
→ Iterable<E>?
-
An Iterable of the objects in this list in reverse order.
no setter
Methods
-
add(E valueToAdd)
→ void
-
Adds value to the end of this list,
extending the length by one.
-
addAll(Iterable<E> iterable)
→ void
-
Appends all objects of
iterable
to the end of this list.
-
asMap()
→ Map<int, E>?
-
An unmodifiable Map view of this list.
-
cast<R>()
→ List<R>?
-
Returns a view of this list as a list of
R
instances.
-
clear()
→ void
-
Removes all objects from this list; the length of the list becomes zero.
-
fillRange(int start, int end, [E? fillValue])
→ void
-
Overwrites a range of elements with
fillValue
.
-
getRange(int start, int end)
→ Iterable<E>?
-
Creates an Iterable that iterates over a range of elements.
-
indexOf(E element, [int start = 0])
→ int?
-
The first index of
element
in this list.
-
indexWhere(bool test(E element), [int start = 0])
→ int?
-
The first index in the list that satisfies the provided
test
.
-
insert(int index, E element)
→ void
-
Inserts
element
at position index
in this list.
-
insertAll(int index, Iterable<E> iterable)
→ void
-
Inserts all objects of
iterable
at position index
in this list.
-
lastIndexOf(E element, [int? start])
→ int?
-
The last index of
element
in this list.
-
lastIndexWhere(bool test(E element), [int? start])
→ int?
-
The last index in the list that satisfies the provided
test
.
-
remove(Object? valueToRemove)
→ bool?
-
Removes the first occurrence of value from this list.
-
removeAt(int index)
→ E?
-
Removes the object at position
index
from this list.
-
removeLast()
→ E?
-
Removes and returns the last object in this list.
-
removeRange(int start, int end)
→ void
-
Removes a range of elements from the list.
-
removeWhere(bool test(E element))
→ void
-
Removes all objects from this list that satisfy
test
.
-
replaceRange(int start, int end, Iterable<E> replacements)
→ void
-
Replaces a range of elements with the elements of
replacements
.
-
retainWhere(bool test(E element))
→ void
-
Removes all objects from this list that fail to satisfy
test
.
-
setAll(int index, Iterable<E> iterable)
→ void
-
Overwrites elements with the objects of
iterable
.
-
setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0])
→ void
-
Writes some elements of
iterable
into a range of this list.
-
shuffle([Random? random])
→ void
-
Shuffles the elements of this list randomly.
-
sort([int compare(E a, E b)?])
→ void
-
Sorts this list according to the order specified by the
compare
function.
-
sublist(int start, [int? end])
→ List<E>?
-
Returns a new list containing the elements between
start
and end
.
Operators
-
operator [](int index)
→ E?
-
The object at the given
index
in the list.
-
operator []=(int index, E valueToSet)
→ void
-
Sets the value at the given
index
in the list to value.