Sequence<T>

Sequence<T>

A sequence is a collection where the elements are ordered. An element may be part of a sequence more than once. Sequence is itself an instance of the metatype SequenceType. A Sentence is not a subtype of Bag. The common supertype of Sentence and Bags is Collection.

conformsTo OrderedCollection<T> , NonUniqueCollection<T>

Operations

=(object2 : OclAny) : Boolean precedence: EQUALITY

True if self contains the same elements as s in the same order.

<>(object2 : OclAny) : Boolean precedence: EQUALITY

append(object : T) : Sequence<T>

The sequence of elements, consisting of all elements of self, followed by object.

excluding(object : OclAny) : Sequence<T>

The sequence containing all elements of self apart from all occurrences of object. The order of the remaining elements is not changed.

flatten<T2>() : Sequence<T2>

Redefines the Collection operation. If the element type is not a collection type, this results in the same sequence as self. If the element type is a collection type, the result is the sequence containing all the elements of all the recursively flattened elements of self. The order of the elements is partial.

including(object : T) : Sequence<T>

The sequence containing all elements of self plus object added as the last element.

insertAt(index : Integer, object : T) : Sequence<T>

The sequence consisting of self with object inserted at position index.

prepend(object : T) : Sequence<T>

The sequence consisting of object, followed by all elements in self.

reverse() : Sequence<T>

The sequence containing the same elements but with the opposite order.

subSequence(lower : Integer, upper : Integer) : Sequence<T>

The sub-sequence of self starting at number lower, up to and including element number upper.

union(s : Sequence<T>) : Sequence<T>

The sequence consisting of all elements in self, followed by all elements in s.

Iterations

reject(i : T | body : Lambda T() : Boolean) : Sequence<T>

The subsequence of the source sequence for which body is false.

select(i : T | body : Lambda T() : Boolean) : Sequence<T>

The subsequence of the source sequence for which body is true.