Initializer
Array({Value*} values = ...)
Parameters:
  • values = {}
Attributes
arraysSource Codeshared {Array*} arrays

Returns this array as a sequence of Array elements.

Throws
booleansSource Codeshared {Boolean*} booleans

Returns this array as a sequence of Boolean elements.

Throws
floatsSource Codeshared {Float*} floats

Returns this array as a sequence of Float elements.

Throws
hashSource 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:

  • if x==y then x.hash==y.hash.

Therefore, a class which refines equals must also refine hash.

In general, hash values vary between platforms and between executions of the same program.

Note that when executing on a Java Virtual Machine, the 64-bit Integer value returned by an implementation of hash is truncated to a 32-bit integer value by taking the exclusive disjunction of the 32 lowest-order bits with the 32 highest-order bits, before returning the value to the caller.

Refines Identifiable.hash ultimately refines Object.hash
integersSource Codeshared {Integer*} integers

Returns this array as a sequence of Integer elements.

Throws
lastIndexSource Codeshared actual Integer? lastIndex

The index of the last element of the list, or null if the list is empty. Always size>0 then size-1.

objectsSource Codeshared {Object*} objects

Returns this array as a sequence of Object elements.

Throws
prettySource Codeshared String pretty

Returns a pretty-printed serialised JSON representation

restSource Codeshared actual Array 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 rest is evaluated.

Therefore, if the stream i has an unstable iteration order, the stream { i.first, *i.rest } might not have the same elements as i.

Refines List.rest ultimately refines Iterable.rest
reversedSource Codeshared actual Array reversed

A list containing the elements of this list in reverse order to the order in which they occur in this list. For every index of a reversed list:

list.reversed[index]==list[size-1-index]

This is a lazy operation returning a view of this list.

sizeSource Codeshared actual Integer size

Returns the number of elements in this array

Refines List.size ultimately refines Iterable.size
stringSource Codeshared actual String string

Returns a serialised JSON representation

Refines Collection.string ultimately refines Object.string
stringsSource Codeshared {String*} strings

Returns this array as a sequence of String elements.

Throws
Inherited Attributes
Attributes inherited from: LangObject
Attributes inherited from: Collection<Element>
Attributes inherited from: Correspondence<Key,Item>
Attributes inherited from: Iterable<Element,Absent>
Attributes inherited from: List<Element>
Methods
addSource Codeshared actual void add(Value val)

Adds a new value at the end of this array

addAllSource Codeshared actual void addAll({Value*} values)

Add the given elements to the end of this list, increasing the length of the list.

clearSource Codeshared actual void clear()

Remove every element from this list, leaving an empty list with no elements.

cloneSource Codeshared actual Array 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.

Refines MutableList.clone ultimately refines Collection.clone
deleteSource Codeshared actual Value delete(Integer index)

Remove the element at the specified index, returning the removed element, if any, or null if there was no such element.

Refines MutableList.delete ultimately refines ListMutator.delete
deleteMeasureSource Codeshared actual void deleteMeasure(Integer from, Integer length)

Remove every element with an index in the measured range from:length. If length<=0, no elements are removed.

deleteSpanSource Codeshared actual void deleteSpan(Integer from, Integer to)

Remove every element with an index in the spanned range from..to.

equalsSource Codeshared actual Boolean equals(LangObject that)

Determine if two values are equal.

For any two non-null objects x and y, x.equals(y) may be written as:

x == y 

Implementations should respect the constraints that:

  • if x===y then x==y (reflexivity),
  • if x==y then y==x (symmetry),
  • if x==y and y==z then x==z (transitivity).

Furthermore it is recommended that implementations ensure that if x==y then x and y have the same concrete class.

A class which explicitly refines equals() is said to support value equality, and the equality operator == is considered much more meaningful for such classes than for a class which simply inherits the default implementation of identity equality from Identifiable.

Note that an implementation of equals() that always returns false does satisfy the constraints given above. Therefore, in very rare cases where there is no reasonable definition of value equality for a class, for example, function references (Callable), it is acceptable for equals() to be defined to return false for every argument.

Refines Identifiable.equals ultimately refines Object.equals
findAndRemoveFirstSource Codeshared actual Value findAndRemoveFirst(Boolean selecting(Value&LangObject element))

Remove the first element that satisfies the given predicate function from this list, returning the removed element, or null if no such element was found in this list.

findAndRemoveLastSource Codeshared actual Value findAndRemoveLast(Boolean selecting(Value&LangObject element))

Remove the last element that satisfies the given predicate function from this list, returning the removed element, or null if no such element was found in this list.

findAndReplaceFirstSource Codeshared actual Value findAndReplaceFirst(Boolean selecting(Value&LangObject element), Value replacement)

Replace the first element of this list that satisfies the given predicate function with the given replacement, returning the replaced element, or null if no such element was found in this list.

findAndReplaceLastSource Codeshared actual Value findAndReplaceLast(Boolean selecting(Value&LangObject element), Value replacement)

Replace the last element of this list that satisfies the given predicate function with the given replacement, returning the replaced element, or null if no such element was found in this list.

getFromFirstSource Codeshared actual Value getFromFirst(Integer index)

The indexth element returned by an iterator of this stream, or null if there are fewer than index+1 elements in the stream. For a stream with an unstable iteration order, a different value might be produced each time getFromFirst(index) is called for a given integer index.

Refines List.getFromFirst ultimately refines Iterable.getFromFirst
infillSource Codeshared actual void infill(Value replacement)

Replace all null values in this list with the given replacement value.

Refines MutableList.infill ultimately refines ListMutator.infill
insertSource Codeshared actual void insert(Integer index, Value val)

Insert the given element at the specified index, incrementing the length of the list.

insertAllSource Codeshared actual void insertAll(Integer index, {Value*} elements)

Insert the given elements at the specified index, growing the length of the list by the number of given elements.

iteratorSource Codeshared actual Iterator<Value> iterator()

An iterator for the elements belonging to this stream.

If this is a nonempty stream with type {Element+}, the iterator must produce at least one element.

Refines List.iterator ultimately refines Iterable.iterator
measureSource Codeshared actual Array measure(Integer from, Integer length)

Obtain a measure containing the mapped values starting from the given starting index (from), with the given length. If length<=0, the resulting measure is empty.

For any ranged stream r, r.measure(from, length) may be written using the measure operator:

r[from:length]

The measure should contain the given number (length) of elements of this stream, starting from the element at the given starting index (from), in the same order as they are produced by the iterator of the stream. In the case where the iterator would be exhausted before length elements are produced, the resulting measure contains only those elements which were produced before the iterator was exhausted, and the length of the measure is less then the given length.

When the given index does not belong to this ranged object, the behavior is implementation dependent.

Refines List.measure ultimately refines Ranged.measure
pruneSource Codeshared actual Integer prune()

Remove all null elements from this list, leaving a list with no null elements, returning the number of elements removed.

Refines MutableList.prune ultimately refines ListMutator.prune
removeSource Codeshared actual Integer remove(ObjectValue val)

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 ListMutator.removeFirst() or ListMutator.removeLast().

Refines MutableList.remove ultimately refines ListMutator.remove
removeAllSource Codeshared actual Integer removeAll({ObjectValue*} elements)

Remove all occurrences of every one of the given values from this list, returning the number of elements removed.

removeFirstSource Codeshared actual Boolean removeFirst(ObjectValue element)

Remove the first occurrence of the given value from this list, if any, returning true if the value occurs in the list, or false otherwise.

removeLastSource Codeshared actual Boolean removeLast(ObjectValue element)

Remove the last occurrence of the given value from this list, if any, returning true if the value occurs in the list, or false otherwise.

removeWhereSource Codeshared actual Integer removeWhere(Boolean selecting(Value&LangObject element))

Remove every element that satisfies the given predicate function from this list, returning the number of elements that were removed.

replaceSource Codeshared actual Integer replace(ObjectValue val, Value newVal)

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 ListMutator.replaceFirst() or ListMutator.replaceLast().

Refines MutableList.replace ultimately refines ListMutator.replace
replaceFirstSource Codeshared actual Boolean replaceFirst(ObjectValue element, Value replacement)

Replace the first occurrence of the given value in this list, if any, with the given replacement value, returning true if the value occurs in the list, or false otherwise.

replaceLastSource Codeshared actual Boolean replaceLast(ObjectValue element, Value replacement)

Replace the last occurrence of the given value in this list, if any, with the given replacement value, returning true if the value occurs in the list, or false otherwise.

replaceWhereSource Codeshared actual Integer replaceWhere(Boolean selecting(Value&LangObject element), Value replacement)

Replace every element in this list that satisfies the given predicate function with the given replacement.

setSource Codeshared actual void set(Integer index, Value val)

Set the item associated with the given index to the given item, replacing the item previously associated with this index.

For any instance c of IndexedCorrespondenceMutator, c.set(index, item) may be written using the item and assignment operators:

c[index] = item
spanSource Codeshared actual Array span(Integer from, Integer to)

Obtain a span containing the elements between the two given indices.

For any ranged stream r, r.span(from, to) may be written using the span operator:

r[from..to]

The span should contain elements of this stream, starting from the element at the given starting index (from), and ending with the element at the given ending index (to), in the same order as they are produced by the iterator of the stream, except when the ending index occurs earlier than the starting index, in which case they occur in the opposite order.

When one or both of the given indices does not belong to this ranged stream, the behavior is implementation dependent.

Refines List.span ultimately refines Ranged.span
spanFromSource Codeshared actual Array spanFrom(Integer from)

Obtain a span containing the elements between the given starting index (from) and the last index of this ranged object.

For any ranged stream r, r.spanFrom(from) may be written using the span operator:

r[from...]

The span should contain elements of this stream, starting from the element at the given starting index (from), in the same order as they are produced by the iterator of the stream.

When the given index does not belong to this ranged stream, the behavior is implementation dependent.

Refines List.spanFrom ultimately refines Ranged.spanFrom
spanToSource Codeshared actual Array spanTo(Integer to)

Obtain a span containing the elements between the first index of this ranged stream and given end index (to).

For any ranged stream r, r.spanTo(to) may be written using the span operator:

r[...to]

The span should contain elements of this stream, up to the element at the given ending index (to), in the same order as they are produced by the iterator of the stream.

When the given index does not belong to this ranged stream, the behavior is implementation dependent.

Refines List.spanTo ultimately refines Ranged.spanTo
truncateSource Codeshared actual void truncate(Integer size)

Truncate this list to the given size by removing elements from the end of the list, if necessary, leaving a list with at most the given size.

Inherited Methods
Methods inherited from: LangObject
Methods inherited from: Category<Element>
Methods inherited from: Collection<Element>
Methods inherited from: Correspondence<Key,Item>
Methods inherited from: IndexedCorrespondenceMutator<Element>
Methods inherited from: Iterable<Element,Absent>
Methods inherited from: List<Element>
Methods inherited from: ListMutator<Element>
Methods inherited from: MutableList<Element>
Methods inherited from: Ranged<Index,Element,Subrange>