A MutableList
implemented as a singly linked list.
Also:
no subtypes hierarchy
Constructors | |
LinkedList | Source Codeshared LinkedList({Element*} elements = ...) Create a new Parameters:
|
copy | Source Codeshared copy(LinkedList<Element> linkedList) Create a new Parameters:
|
Attributes | |
back | Source Codeshared actual Element? back The element currently at the back of the
queue, or Refines Queue.back |
first | Source Codeshared actual Element? first The first element returned by the iterator, if any, or
|
front | Source Codeshared actual Element? front The element currently at the front of the
queue, or Refines Queue.front |
hash | Source Codeshared actual Integer hash The hash value of the value, which allows the value to be an element of a hash-based set or key of a hash-based map. Implementations must respect the constraint that:
Therefore, a class which refines Because the |
last | Source Codeshared actual Element? last The last element returned by the iterator, if any, or
|
lastIndex | Source Codeshared actual Integer? lastIndex The index of the last element of the list, or Refines List.lastIndex |
size | Source Codeshared actual Integer size The number of elements returned by the |
top | Source Codeshared actual Element? top The element currently at the top of the stack,
or Refines Stack.top |
Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Collection<Element> |
Attributes inherited from: Correspondence<Key,Item> |
Attributes inherited from: Iterable<Element,Absent> |
Attributes inherited from: List<Element> |
Attributes inherited from: Queue<Element> |
Attributes inherited from: Stack<Element> |
Methods | |
accept | Source Codeshared actual Element? accept() Remove and return the element at the front of the queue. Refines Queue.accept |
add | Source Codeshared actual void add(Element element) Refines ListMutator.add |
addAll | Source Codeshared actual void addAll({Element*} elements) Refines ListMutator.addAll |
any | Source Codeshared actual Boolean any(Boolean selecting(Element element)) Determines if there is at least one element of this
stream that satisfies the given predicate
function ( Refines Iterable.any |
clear | Source Codeshared actual void clear() Remove every element from this list, leaving an empty list with no elements. Refines ListMutator.clear |
clone | Source Codeshared actual LinkedList<Element> clone() A shallow copy of this collection, that is, a collection with identical elements which does not change if this collection changes. If this collection is immutable, it is acceptable to return a reference to this collection. If this collection is mutable, a newly instantiated collection must be returned. |
collect | Source Codeshared actual Result[] collect<Result>(Result collecting(Element element)) Produce a new sequence ( This operation is an eager counterpart to it.collect(f) == [*it.map(f)] |
contains | Source Codeshared actual Boolean contains(Object element) Returns For most
However, it is possible to form a useful |
count | Source Codeshared actual Integer count(Boolean selecting(Element element)) Produces the number of elements in this stream that
satisfy the given predicate function ( Refines Iterable.count |
defines | Source Codeshared actual Boolean defines(Integer index) Determines if there is a value defined for the given key. |
delete | Source Codeshared actual Element? delete(Integer index) Remove the element at the specified |
deleteMeasure | Source Codeshared actual void deleteMeasure(Integer from, Integer length) Remove every element with an index in the measured
range Refines ListMutator.deleteMeasure |
deleteSpan | Source Codeshared actual void deleteSpan(Integer from, Integer to) Remove every element with an index in the spanned range
Refines ListMutator.deleteSpan |
each | Source Codeshared actual void each(void step(Element element)) Call the given function ( For example: words.each((word) { print(word.lowercased); print(word.uppercased); }); Has the same effect as the following for (word in words) { print(word.lowercased); print(word.uppercased); } For certain streams this method is highly efficient,
surpassing the performance of Refines Iterable.each |
equals | Source Codeshared actual Boolean equals(Object that) Determine if two values are equal. Implementations should respect the constraints that:
Furthermore it is recommended that implementations
ensure that if A class which explicitly refines |
every | Source Codeshared actual Boolean every(Boolean selecting(Element element)) Determines if all elements of this stream satisfy the
given predicate function ( Refines Iterable.every |
find | Source Codeshared actual Element? find(Boolean selecting(Element&Object elem)) The first element of this stream which satisfies the
given predicate function ( For example, the expression (-10..10).find(Integer.positive) evaluates to |
findLast | Source Codeshared actual Element? findLast(Boolean selecting(Element&Object elem)) The last element of this stream which satisfies the
given predicate function ( For example, the expression (-10..10).findLast(3.divides) evaluates to |
firstIndexWhere | Source Codeshared actual Integer? firstIndexWhere(Boolean selecting(Element&Object element)) The first index in this list for which the element is
not null and satisfies the given
predicate function ( Refines List.firstIndexWhere |
getFromFirst | Source Codeshared actual Element? getFromFirst(Integer index) The |
infill | Source Codeshared actual void infill(Element replacement) Replace all null values in this list with the given replacement value. Refines ListMutator.infill |
insert | Source Codeshared actual void insert(Integer index, Element element) Parameters:
Refines ListMutator.insert |
insertAll | Source Codeshared actual void insertAll(Integer index, {Element*} elements) Insert the given Parameters:
Refines ListMutator.insertAll |
iterator | Source Codeshared actual Iterator<Element> iterator() An iterator for the elements belonging to this stream. |
lastIndexWhere | Source Codeshared actual Integer? lastIndexWhere(Boolean selecting(Element&Object element)) The last index in this list for which the element is
not null and satisfies the given
predicate function ( Refines List.lastIndexWhere |
measure | Source Codeshared actual List<Element> measure(Integer from, Integer length) Obtain a measure containing the mapped values starting
from the given starting index ( The measure should contain the given number ( When the given index does not belong to this ranged object, the behavior is implementation dependent. |
offer | Source Codeshared actual void offer(Element element) Add a new element to the back of the queue. Refines Queue.offer |
pop | Source Codeshared actual Element? pop() Remove and return the element at the top of the stack. Refines Stack.pop |
prune | Source Codeshared actual void prune() Remove all null elements from this list, leaving a list with no null elements. Refines ListMutator.prune |
push | Source Codeshared actual void push(Element element) Push a new element onto the top of the stack. Refines Stack.push |
reduce | Source Codeshared actual Result|Element|Null reduce<Result>(Result accumulating(Result|Element partial, Element element)) Beginning with the For an empty stream, For a stream with one element, { first }.reduce(f) == first For a given stream it.reduce(f) == f(it.exceptLast.reduce(f), it.last) For example, the expression (1..100).reduce(plus) results in the integer Refines Iterable.reduce |
remove | Source Codeshared actual Integer remove(Element&Object element) Remove all occurrences of the given value from this list, returning the number of elements removed. To remove just one occurrence of the given value, use
Refines ListMutator.remove |
removeAll | Source Codeshared actual Integer removeAll({Element&Object*} elements) Remove all occurrences of every one of the given values from this list, returning the number of elements removed. Refines ListMutator.removeAll |
removeFirst | Source Codeshared actual Boolean removeFirst(Element&Object element) Remove the first occurrence of the given
value from this list, if any, returning
Refines ListMutator.removeFirst |
removeLast | Source Codeshared actual Boolean removeLast(Element&Object element) Remove the last occurrence of the given
value from this list, if any, returning
Refines ListMutator.removeLast |
replace | Source Codeshared actual void replace(Element&Object element, Element replacement) Replace all occurrences of the given value in this list with the given replacement value. To replace just one occurrence of the given value, use
Refines ListMutator.replace |
replaceFirst | Source Codeshared actual Boolean replaceFirst(Element&Object element, Element replacement) Replace the first occurrence of the given
value in this list, if any, with the given
replacement value, returning Refines ListMutator.replaceFirst |
replaceLast | Source Codeshared actual Boolean replaceLast(Element&Object element, Element replacement) Replace the last occurrence of the given
value in this list, if any, with the given
replacement value, returning Refines ListMutator.replaceLast |
sequence | Source Codeshared actual Element[] sequence() A sequence ( Refines Iterable.sequence |
set | Source Codeshared actual void set(Integer index, Element element) Parameters:
Refines ListMutator.set |
span | Source Codeshared actual List<Element> span(Integer from, Integer to) Obtain a span containing the elements between the two given indices. The span should contain elements of this stream,
starting from the element at the given starting
index ( When one or both of the given indices does not belong to this ranged stream, the behavior is implementation dependent. |
spanFrom | Source Codeshared actual List<Element> spanFrom(Integer from) Obtain a span containing the elements between the given
starting index ( The span should contain elements of this stream,
starting from the element at the given starting
index ( When the given index does not belong to this ranged stream, the behavior is implementation dependent. |
spanTo | Source Codeshared actual List<Element> spanTo(Integer to) Obtain a span containing the elements between the first
index of this ranged stream and given end index ( The span should contain elements of this stream, up to
the element at the given ending index ( When the given index does not belong to this ranged stream, the behavior is implementation dependent. |
truncate | Source Codeshared actual void truncate(Integer size) Truncate this list to the given Parameters:
Refines ListMutator.truncate |