# Set(T)

## `Set(T)`

conformsTo `UniqueCollection(T)`

Operations

`=(object2 : OclSelf[?]) : Boolean[1]` precedence: `EQUALITY`

Evaluates to `true` if `self` and s contain the same elements.

`<>(object2 : OclSelf[?]) : Boolean[1]` precedence: `EQUALITY`

`-(s : UniqueCollection(OclAny)) : Set(T)` precedence: `ADDITIVE`

The elements of `self`, which are not in s.

`excluding(object : OclAny[?]) : Set(T)`

The set containing all elements of `self` without object.

`excludingAll(objects : Collection(OclAny)) : Set(T)`

The set containing all elements of `self` apart from all occurrences of all objects.

`flatten(T2)() : Set(T2)`

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

`including(object : T[?]) : Set(T)`

The set containing all elements of `self` plus object.

`includingAll(objects : Collection(T)) : Set(T)`

The set containing all elements of `self` and objects.

`selectByKind(TT)(type : TT[?]) : Set(TT)`

`selectByType(TT)(type : TT[?]) : Set(TT)`

Iterations

`closure(i : T[1] | lambda : Lambda T() : Set(T)[?]) : Set(T)`

The closure of applying body transitively to every distinct element of the source collection.

`collect(V)(i : T[?] | lambda : Lambda T() : V[?]) : Bag(V)`

`collectNested(V)(i : T[?] | lambda : Lambda T() : V[?]) : Bag(V)`

The Bag of elements which results from applying body to every member of the source nonordered collection.

`reject(i : T[?] | lambda : Lambda T() : Boolean[1]) : Set(T)`

The subset of the source set for which body is `false`.

`select(i : T[?] | lambda : Lambda T() : Boolean[1]) : Set(T)`

The subset of set for which expr is `true`.

`sortedBy(i : T[?] | lambda : Lambda T() : OclAny[?]) : OrderedSet(T)`

Results in the ordered set containing all elements of the source collection. The element for which body has the lowest value comes first, and so on. The type of the body expression must have the < operation defined. The < operation must return a Boolean value and must be transitive (i.e., if a < b and b < c, then a < c).