🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
OCLOperators orderGeneric


Sorts a collection by one or more expressions, with an explicit direction for each sort key. Pass the expression and direction in pairs, using OclSortDirection::ascending or OclSortDirection::descending: (expr1, OclSortDirection::ascending, expr2, OclSortDirection::descending...)

Example

If we have a class Car with attributes Name and Country.

We can use orderGeneric like this.

Car.allInstances->orderGeneric(Name, OclSortDirection::ascending)
Error creating thumbnail: File missing