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 In general, Note that when executing on a Java Virtual Machine, the
64-bit |
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 any instance element in c 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. For any two non-null objects x == y Implementations should respect the constraints that:
Furthermore it is recommended that implementations
ensure that if A class which explicitly refines Note that an implementation of |
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 is not null and
satisfies the given predicate function ( For example, the expression (-10..10).find(Integer.positive) evaluates to |
findAndRemoveFirst | Source Codeshared actual Element? findAndRemoveFirst(Boolean selecting(Element&Object element)) Remove the first element that satisfies the given
predicate function from this list,
returning the removed element, or Refines MutableList.findAndRemoveFirst |
findAndRemoveLast | Source Codeshared actual Element? findAndRemoveLast(Boolean selecting(Element&Object element)) Remove the last element that satisfies the given
predicate function from this list,
returning the removed element, or Refines MutableList.findAndRemoveLast |
findAndReplaceFirst | Source Codeshared actual Element? findAndReplaceFirst(Boolean selecting(Element&Object element), Element replacement) Replace the first element of this list that satisfies
the given predicate function with
the given Refines MutableList.findAndReplaceFirst |
findAndReplaceLast | Source Codeshared actual Element? findAndReplaceLast(Boolean selecting(Element&Object element), Element replacement) Replace the last element of this list that satisfies
the given predicate function with
the given Refines MutableList.findAndReplaceLast |
findLast | Source Codeshared actual Element? findLast(Boolean selecting(Element&Object elem)) The last element of this stream which is not null and
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. |
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. If this is a nonempty stream with type |
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 ( For any ranged stream r[from:length] 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 Integer prune() Remove all null elements from this list, leaving a list with no null elements, returning the number of elements removed. |
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 |
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 |
removeWhere | Source Codeshared actual Integer removeWhere(Boolean selecting(Element&Object element)) Remove every element that satisfies the given predicate function from this list, returning the number of elements that were removed. Refines MutableList.removeWhere |
replaceWhere | Source Codeshared actual Integer replaceWhere(Boolean selecting(Element&Object element), Element replacement) Replace every element in this list that satisfies the
given predicate function with the given
Refines MutableList.replaceWhere |
sequence | Source Codeshared actual [Element+]|[] sequence() A sequence ( If this stream is known to be nonempty, that is, if it
is an instance of [String+] bits = "hello world".split().sequence(); Refines Iterable.sequence |
set | Source Codeshared actual void set(Integer index, Element element) Set the item associated with the given For any instance c[index] = item Parameters:
|
span | Source Codeshared actual List<Element> span(Integer from, Integer to) Obtain a span containing the elements between the two given indices. For any ranged stream r[from..to] 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 ( For any ranged stream r[from...] 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 ( For any ranged stream r[...to] 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 |