When I have a result of type Set(Integer)
, numbers are not ordered. We have an operation usable on collections called sortedBy ( expr : OclExpression ) : Sequence(T)
, but when there's only integers in this set, what's the expression to use?
Asked
Active
Viewed 1,094 times
0

sgy
- 2,922
- 2
- 35
- 42
1 Answers
2
You can just use the asOrderedSet operation (if your collection is in the variable X, then that would be X->asOrderedSet())
From the OCL Standard asOrderedSet() : OrderedSet(T) An OrderedSet that contains all the elements from self, with duplicates removed, in an order dependent on the particular concrete collection type.

Jordi Cabot
- 8,058
- 2
- 33
- 39