A Sequence
backed by an Array
.
Since Array
s are mutable, this class is private to the
language module, where we can be sure the Array
is not
modified after the ArraySequence
has been initialized.
sequence()
no subtypes hierarchy
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 | |
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 default [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 |
getFromFirst | Source Codeshared actual Element? getFromFirst(Integer index) The Refines Iterable.getFromFirst |
iterator | Source Codeshared actual Iterator<Element> iterator() An iterator for the elements belonging to this stream. Refines Iterable.iterator |
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. |
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 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 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. |