Professional Documents
Culture Documents
en t
qu Se
Cite this
ce
Se red
Reference Card
de
t
g
Collection type operations Description
Se
Ba
Or
collection->size(): Integer V V V V Number of elements in the self collection
collection->isEmpty(): Boolean V V V V True if the self collection is empty
collection->notEmpty(): Boolean V V V V True if the self collection is not empty
collection1 = collection2 : Boolean V V V V True if the first collection is equal to the second collection
collection1 <> collection2 : Boolean V V V V True if the first collection is different to the second collection
collection->isUnique(expr: T): Boolean V V V V True if the argument expression is unique within the self collection
collection->select(expr: Boolean): Collection(T) V V V V Elements of the self collection that match the argument condition
collection->reject(expr: Boolean): Collection(T) V V V V Elements of the self collection that do not match the argument condition
collection->sortedBy(OclBasicType): Sequence(T) V V V V Elements of the self collection sorted by the argument expression
collection->collect(expr: T): Collection(T) V V V V Flattened collection of expression values obtained from the self collection members
collection->collectNested(expr: T): Collection(T) V V V V Nested collection of expression values obtained from the self collection members
collection->iterate(x:I [; acc:J=init]|expr: T|Collection(T)): T|Collection(T) V V V V Iterator that allows defining its logic
collection->forAll(expr: Boolean): Boolean V V V V True if the argument expression holds for all members of the self collection
collection->exists(expr: Boolean): Boolean V V V V True if the argument holds for at least one member of the self collection
collection->one(expr: Boolean): Boolean V V V V True if the argument holds for only one member of the self collection
collection->includes(element: T): Boolean V V V V True if the argument is part of the self collection
collection->excludes(element: T): Boolean V V V V True if the argument is not part of the self collection
collection->includesAll(collection: Collection(T)): Boolean V V V V True if all members of the argument collection belong to the self collection
collection->excludesAll(collection: Collection(T)): Boolean V V V V True if none of the members of the argument collection belong to the self collection
collection->including(element: T): Collection(T) V V V V The self collection with the argument added to it
collection->excluding(element: T): Collection(T) V V V V The self collection with the argument removed from it
collection->union(collection: Collection(T)): Collection(T) V V V V The union of the self collection with the argument collection
collection->intersection(collection: Set(T) | Bag(T)): Set(T) | Bag(T) V V The intersection of the self collection with the argument collection
collection1 - collection2: Set(T) V The first set excluding all elements of the second set
collection->symmetricDifference(collection: Set(T)): Set(T) V Union of the self collection with the argument collection, minus their intersection
collection->prepend(element: T): OrderedSet(T) | Sequence(T) V V The self (ordered) collection prepended with the argument
collection->insertAt(pos:Integer,element:T):OrderedSet(T)|Sequence(T) V V The self (ordered) collection with the argument inserted at the position
collection->reverse(): OrderedSet(T) | Sequence(T) V V The self (ordered) collection in reverse order
collection->append(element: T): OrderedSet(T) | Sequence(T) V V The self (ordered) collection appended with the argument
collection->flatten(): Collection(T) V V V V The self collection flattened; only produces effect if the self collection is nested
collection->sum(): Integer | Real V V V V The addition of all elements of an Integer or Real collection
collection->max(): Integer | Real V V V V The largest element of an Integer or Real collection
collection->min(): Integer | Real V V V V The smallest element of an Integer or Real collection
collection->first(): T V V First element of the self (ordered) collection
collection->at(position: Integer): T V V Element of the self (ordered) collection at the given position
collection->last(): T V V Last element of the self (ordered) collection
collection->any(expr: Boolean): T V V V V Any element of the self collection for which the argument expression is true
collection->indexOf(element: T): Integer V V Position within the self collection of the argument; undefined if not found
collection->count(element: T): Integer V V V V The number of times the argument occurs in the self collection
collection->subOrderedSet(lower: Integer, upper: Integer): OrderedSet(T) V Subset of the self ordered set, between the two argument positions
collection->subSequence(lower: Integer, upper: Integer): Sequence(T) V Subsequence of the self sequence, between the two argument positions
collection->asSet(): Set(T) V V V V Cast operator to type T (eliminates duplicates, does not preserve existing order)
collection->asBag(): Bag(T) V V V V Cast operator to type T (does not preserve existing order)
collection->asOrderedSet(): OrderedSet(T) V V V V Cast operator to type T (eliminates duplicates, preserves existing order)
collection->asSequence(): Sequence(T) V V V V Cast operator to type T (preserves existing order)
St er
g
g
rin
ol
al
te
In