ListOperators<E> extension
Properties
-
first
↔ E
-
Returns the first element.
getter/setter pair
-
isEmpty
→ bool
-
Returns
true
if there are no elements in this collection.
no setter
-
isNotEmpty
→ bool
-
Returns true if there is at least one element in this collection.
no setter
-
last
↔ E
-
Returns the last element.
getter/setter pair
-
length
↔ int
-
The number of objects in this list.
getter/setter pair
-
single
→ E
-
Checks that this iterable has only one element, and returns that element.
no setter
Methods
-
add(E value)
→ 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>
-
Returns an unmodifiable Map view of
this
.
-
clear()
→ void
-
Removes all objects from this list;
the length of the list becomes zero.
-
insert(int index, E element)
→ void
-
Inserts the object at position
index
in this list.
-
insertAll(int index, Iterable<E> iterable)
→ void
-
Inserts all objects of
iterable
at position index
in this list.
-
listUpdated()
→ void
-
Notify listener that the list or its values have been updated
-
remove(Object? value)
→ 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
-
Pops and returns the last object in this list.
-
removeWhere(bool test(E element))
→ void
-
Removes all objects from this list that satisfy
test
.
-
retainWhere(bool test(E element))
→ void
-
Removes all objects from this list that fail to satisfy
test
.
-
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.
Operators
-
operator +(List<E> other)
→ List<E>
-
Returns the concatenation of this list and
other
.
-
operator [](int index)
→ E
-
Returns the object at the given
index
in the list
or throws a RangeError if index
is out of bounds.
-
operator []=(int index, E value)
→ void
-
Sets the value at the given
index
in the list to value
or throws a RangeError if index
is out of bounds.