Initializer |
ArraySequence(Array<Element> array) |
Attributes | |
first | Source Codeshared actual Element first The first element returned by the iterator, if any, or
|
last | Source Codeshared actual Element last The last element returned by the iterator, if any, or
|
rest | Source Codeshared actual Element[] rest A stream containing all but the first element of this
stream. For a stream with an unstable iteration order,
a different stream might be produced each time Therefore, if the stream |
size | Source Codeshared actual Integer size The number of elements returned by the |
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: [Element+] |
Attributes inherited from: Element[] |
Methods | |
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. If the stream is empty, returns
Refines Iterable.any |
clone | Source Codeshared actual [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 containing the results of applying the given mapping to the elements of this stream. 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. For an infinite stream, this method never terminates. Refines Iterable.count |
each | Source Codeshared actual void each(void step(Element element)) Call the given function for each element of this stream, passing the elements in the order they occur in this stream. 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 |
every | Source Codeshared actual Boolean every(Boolean selecting(Element element)) Determines if all elements of this stream satisfy the
given predicate function. If the stream
is empty, return Refines Iterable.every |
find | Source Codeshared actual Element? find(Boolean selecting(Element&Object element)) The first element of this stream which satisfies the
given predicate function, if any, or
For example, the expression (-10..10).find(Integer.positive) evaluates to |
findLast | Source Codeshared actual Element? findLast(Boolean selecting(Element&Object element)) The last element of this stream which satisfies the
given predicate function, if any, or
For example, the expression (-10..10).findLast(3.divides) evaluates to |
getFromFirst | Source Codeshared actual Element? getFromFirst(Integer index) The |
iterator | Source Codeshared actual Iterator<Element> iterator() An iterator for the elements belonging to this stream. |
measure | Source Codeshared actual Element[] measure(Integer from, Integer length) Obtain a measure containing the mapped values starting
from the given starting index, with the given
The measure should contain the given number
of elements of this stream, starting from the element
at the given starting index, in the same order
as they are produced by the When the given index does not belong to this ranged object, the behavior is implementation dependent. |
reduce | Source Codeshared actual Result|Element 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 |
sort | Source Codeshared actual [Element+] sort(Comparison comparing(Element x, Element y)) Produce a new sequence containing the elements of this stream, sorted according to the given comparator function imposing a partial order upon the elements of the stream. For convenience, the functions For example, this expression "Hello World!".sort(byIncreasing(Character.lowercased)) evaluates to the sequence
This operation is eager by nature. Note that the toplevel function |
span | Source Codeshared actual 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, and ending with the element at the given
ending index, in the same order as they are
produced by the When one or both of the given indices does not belong to this ranged stream, the behavior is implementation dependent. |
spanFrom | Source Codeshared actual ArraySequence<Element>|[] spanFrom(Integer from) Obtain a span containing the elements between the given starting index and the last index of this ranged object. The span should contain elements of this stream,
starting from the element at the given starting
index, in the same order as they are produced by
the When the given index does not belong to this ranged stream, the behavior is implementation dependent. |
spanTo | Source Codeshared actual ArraySequence<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, in the
same order as they are produced by the When the given index does not belong to this ranged stream, the behavior is implementation dependent. |