Chapter 8. Orderings

An Ordering object defines how a list of objects should be ordered. Orderings are essentially path expressions combined with a sorting strategy. Creating an Ordering:

Ordering o = new Ordering(Painting.NAME_PROPERTY, SortOrder.ASENDING);

Like expressions, orderings are translated into SQL as parts of queries (and the sorting occurs in the database). Also like expressions, orderings can be used in memory, naturally - to sort objects:

Ordering o = new Ordering(Painting.NAME_PROPERTY, SortOrder.ASCENDING_INSENSITIVE);
List<Painting> list = ...
o.orderList(list);

Note that unlike filtering with Expressions, ordering is performed in-place. This list object is reordered and no new list is created.