A possibly-empty, immutable sequence of values. The type Sequential<Element> may be abbreviated [Element*] or Element[].

Sequential has two enumerated subtypes:

  • Empty, abbreviated [], represents an empty sequence, and
  • Sequence<Element>, abbreviated [Element+] represents a non-empty sequence, and has the very important subclass Tuple.
See also Tuple

no type hierarchy

Attributes
keysSource Codeshared actual default Integer[] keys

A sequence containing all indexes of this sequence.

Refines List.keys ultimately refines Correspondence.keys
restSource Codeshared formal Element[] rest

The rest of the sequence, without the first element.

Refines List.rest ultimately refines Iterable.rest
reversedSource Codeshared formal Element[] 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.

stringSource Codeshared actual default String string

A string of form "[ x, y, z ]" where x, y, and z are the string representations of the elements of this collection, as produced by the iterator of the collection, or the string "{}" if this collection is empty. If the collection iterator produces the value null, the string representation contains the string "null".

Refines Collection.string ultimately refines Object.string
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
appendSource Codeshared formal <Element|Other>[] append<Other>(Other[] elements)

Return a sequence containing the elements of this sequence, in the order in which they occur in this sequence, followed by the given elements, in the order in which they occur in the given sequence.

cloneSource Codeshared actual default Element[] clone()

This sequence.

Refines List.clone ultimately refines Collection.clone
initialSource Codeshared actual default Element[] initial(Integer length)

Select the first elements of this sequence, returning a sequence no longer than the given length. If this sequence is shorter than the given length, return this sequence. Otherwise return a sequence of the given length.

Refines List.initial
prependSource Codeshared formal <Element|Other>[] prepend<Other>(Other[] elements)

Return a sequence containing the given elements, in the order in which they occur in the given sequence, followed by the elements of this sequence, in the order in which they occur in this sequence.

repeatSource Codeshared formal Element[] repeat(Integer times)

Produces a stream formed by repeating the elements of this stream the given number of times, or an empty stream if times<=0.

For example, the expression

{ 1, 2 }.repeat(3)

evaluates to the stream { 1, 2, 1, 2, 1, 2 }.

Refines List.repeat ultimately refines Iterable.repeat
sequenceSource Codeshared actual default Element[] sequence()

This sequence.

sliceSource Codeshared actual default [Element[], Element[]] slice(Integer index)

Return two sequences, the first containing the elements that occur before the given index, the second with the elements that occur after the given index. If the given index is outside the range of indices of this list, one of the returned sequences will be empty.

Refines List.slice
terminalSource Codeshared actual default Element[] terminal(Integer length)

Select the last elements of the sequence, returning a sequence no longer than the given length. If this sequence is shorter than the given length, return this sequence. Otherwise return a sequence of the given length.

trimSource Codeshared actual default Element[] trim(Boolean trimming(Element&Object elem))

Trim the elements satisfying the given predicate function from the start and end of this sequence, returning a sequence no longer than this sequence.

Refines List.trim
trimLeadingSource Codeshared actual default Element[] trimLeading(Boolean trimming(Element&Object elem))

Trim the elements satisfying the given predicate function from the start of this sequence, returning a sequence no longer than this sequence.

trimTrailingSource Codeshared actual default Element[] trimTrailing(Boolean trimming(Element&Object elem))

Trim the elements satisfying the given predicate function from the end of this sequence, returning a sequence no longer than this sequence.

withLeadingSource Codeshared formal [Other, Element*] withLeading<Other>(Other element)

Returns a new sequence that starts with the specified element, followed by the elements of this sequence, in the order they occur in this sequence.

Parameters:
  • element

    The first element of the resulting sequence.

withTrailingSource Codeshared formal [<Element|Other>+] withTrailing<Other>(Other element)

Returns a new sequence that starts with the elements of this sequence, in the order they occur in this sequence, and ends with the specified element.

Parameters:
  • element

    The last element of the resulting sequence.

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