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
keysshared actual default Integer[] keys

A sequence containing all indexes of this sequence, that is, every index in the range 0:sequence.size.

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

The rest of the sequence, without the first element.

Refines List.rest ultimately refines Iterable.rest
reversedshared formal Element[] reversed

A sequence containing the elements of this sequence in reverse order to the order in which they occur in this sequence, or the empty sequence if this sequence is the empty sequence.

sizeshared formal Integer size

The strictly-positive length of this sequence, that is, the number of elements in this sequence.

Refines List.size ultimately refines Iterable.size
stringshared 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
appendshared 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.

cloneshared actual default Element[] clone()

This sequence.

Refines List.clone ultimately refines Collection.clone
initialshared 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
prependshared 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.

repeatshared formal Element[] repeat(Integer times)

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

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

This sequence.

sliceshared actual default Element[][2] 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
terminalshared 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.

trimshared actual default Element[] trim(Boolean trimming(Element&Object element))

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

Parameters:
  • trimming

    The predicate function that determines if an element at the start or end of this sequence should be trimmed

Refines List.trim
trimLeadingshared actual default Element[] trimLeading(Boolean trimming(Element&Object element))

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

Parameters:
  • trimming

    The predicate function that determines if an element at the start of this sequence should be trimmed

trimTrailingshared actual default Element[] trimTrailing(Boolean trimming(Element&Object element))

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

Parameters:
  • trimming

    The predicate function that determines if an element at the end of this sequence should be trimmed

withLeadingshared 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.

withTrailingshared 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>