A fixed-sized array of mutable elements. An empty array
is an array of size
0
. Any element of an array may be
set to a new value.
value array = Array { "hello", "world" }; array.set(0, "goodbye");
This class is provided primarily to support interoperation with Java, and for some performance-critical low-level programming tasks.
no subtypes hierarchy
Initializer |
Array({Element*} elements) |
Attributes | |
empty | Source Codeshared actual Boolean empty Determines if the stream is empty, that is to say, if the iterator returns no elements. |
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
|
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 |
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> |
Methods | |
by | Source Codeshared actual {Element*} by(Integer step) Produces a stream containing every For example, the expression (0..10).by(3) results in the stream The step size must be greater than zero. Refines Iterable.by |
clone | Source Codeshared actual Array<Element> clone() A new array with the same elements as this array. |
contains | Source Codeshared actual Boolean contains(Object element) Returns For most
However, it is possible to form a useful |
copyTo | Source Codeshared void copyTo(Array<Element> destination, Integer sourcePosition = 0, Integer destinationPosition = 0, Integer length = ...) Efficiently copy the elements in the segment
Parameters:
|
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 |
defines | Source Codeshared actual Boolean defines(Integer index) Determines if there is a value defined for the given key. |
getFromFirst | Source Codeshared actual Element? getFromFirst(Integer index) Get the element at the specified index, or |
getFromLast | Source Codeshared actual Element? getFromLast(Integer index) Get the element at the specified index, where the array
is indexed from the end of the array, or Refines List.getFromLast |
iterator | Source Codeshared actual Iterator<Element> iterator() An iterator for the elements belonging to this stream. |
measure | Source Codeshared actual Array<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. |
reverseInPlace | Source Codeshared void reverseInPlace() Reverses the order of the current elements in this array. This operation modifies the array. |
sequence | Source Codeshared actual Element[] sequence() A sequence containing all the elements of this stream, in the same order they occur in this stream. This operation eagerly evaluates and collects every element of the stream. Refines Iterable.sequence |
set | Source Codeshared void set(Integer index, Element element) Replace the existing element at the specified index with the given element. Parameters:
Throws
|
skip | Source Codeshared actual {Element*} skip(Integer skipping) Produces a stream containing the elements of this
stream, after skipping the first If this stream does not contain more elements than the specified number of elements to skip, the resulting stream has no elements. If the specified number of elements to skip is zero or fewer, the resulting stream contains the same elements as this stream. Refines Iterable.skip |
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 Refines Iterable.sort |
sortInPlace | Source Codeshared void sortInPlace(Comparison comparing(Element x, Element y)) Sorts the elements in this array according to the order induced by the given comparison function. This operation modifies the array. |
span | Source Codeshared actual Array<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 Array<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 Array<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. |
take | Source Codeshared actual {Element*} take(Integer taking) Produces a stream containing the first If the specified number of elements to take is larger than the number of elements of this stream, the resulting stream contains the same elements as this stream. If the specified number of elements to take is fewer than one, the resulting stream has no elements. Refines Iterable.take |