OCLOperators append
Created by Alexandra on 2017-08-13 · Last edited by Colline.ssali on 2025-12-27.
->append ( object : T ) : Sequence(T)
The append() operator is used to add an element to the end of a collection, returning a new collection that includes the added element. It does not modify the original collection but produces a new one with the additional item. This operator is typically used with ordered collections such as Sequence or OrderedSet, where the position of elements matters
Returns a Sequence containing all elements of self followed by object.
| Expression | Result |
|---|---|
| Sequence{'a', 'b'}->append('c') | Sequence{'a', 'b', 'c'} |
Note! Append does NOT change the "source" sequence. If you want to add an object to an association, use .add
The opposite, excluding an object from a collection without changing the "source" collection - use excluding.
