Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我有 type 的结果时Set(Integer),数字没有排序。我们有一个可用于集合的操作,称为sortedBy ( expr : OclExpression ) : Sequence(T),但是当这个集合中只有整数时,要使用什么表达式?
Set(Integer)
sortedBy ( expr : OclExpression ) : Sequence(T)
您可以只使用 asOrderedSet 操作(如果您的集合在变量 X 中,那么就是 X->asOrderedSet())
来自 OCL 标准 asOrderedSet() : OrderedSet(T) 一个 OrderedSet,包含来自 self 的所有元素,删除了重复项,其顺序取决于特定的具体集合类型。