# UniqueCollection(T)

## `UniqueCollection(T)`

The UniqueCollection type provides the shared functionality of the OrderedSet and Set collections for which the elements are unique. The common supertype of UniqueCollection is Collection.

conformsTo `Collection(T)`

Operations

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

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

`intersection(c : Collection(T)) : Set(T)`

The intersection of `self` and c (i.e., the set of all elements that are in both `self` and c).

`symmetricDifference(s : UniqueCollection(OclAny)) : Set(T)`

The set containing all the elements that are in `self` or s, but not in both.

`union(s : UniqueCollection(T)) : Set(T)`

The set consisting of all elements in `self` and all elements in s.

Iterations

`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).