# Class Orderings

java.lang.Object
java.util.AbstractCollection<Ordering>
java.util.AbstractList<Ordering>
java.util.ArrayList<Ordering>
org.apache.cayenne.query.Orderings

All Implemented Interfaces:
  `Serializable, Cloneable, Iterable<Ordering>, Collection<Ordering>, List<Ordering>, RandomAccess, SequencedCollection<Ordering>`

public class Orderings extends ArrayList<Ordering>

Orderings is provided so that you can chain Ordering together and then use the result to pass into methods that require List<Ordering>

Example:

    Person.COMPANY_NAME.asc().then(Person.FIRST_NAME.desc)

Since:
  4.1
See Also:
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class AbstractList

  `modCount`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Orderings()`
  `Orderings(int initialCapacity)`
  `Orderings(Collection<? extends Ordering> c)`
  `Orderings(Ordering ordering)`
  `Orderings(Ordering... orderings)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T> List<T>`
  `orderedList(Collection<T> objects)`
  Returns an list sorted with these Orderings.
  `<T> void`
  `orderList(List<T> list)`
  Sorts the given array with these Orderings.
  `Orderings`
  `then(List<Ordering> nextOrderings)`
  `Orderings`
  `then(Ordering nextOrdering)`
  Adds the given sort ordering to the end of this list and returns "this" so it can be chained again.
  `Orderings`
  `then(Orderings nextOrderings)`
  Adds the given sort orderings to the end of this list and returns "this" so it can be chained again.

  ### Methods inherited from class ArrayList

  `add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize`

  ### Methods inherited from class AbstractCollection

  `containsAll, toString`

  ### Methods inherited from class Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface Collection

  `parallelStream, stream, toArray`

  ### Methods inherited from interface List

  `containsAll, reversed`

- ## Constructor Details

  - ### Orderings

    public Orderings()

  - ### Orderings

    public Orderings(int initialCapacity)

  - ### Orderings

    public Orderings(Collection<? extends Ordering> c)

  - ### Orderings

    public Orderings(Ordering ordering)

  - ### Orderings

    public Orderings(Ordering... orderings)

- ## Method Details

  - ### then

    public Orderings then(Ordering nextOrdering)
    Adds the given sort ordering to the end of this list and returns "this" so it can be chained again.
    Parameters:
      `nextOrdering` - the sort ordering to add
    Returns:
      this (with nextOrdering appended)

  - ### then

    public Orderings then(Orderings nextOrderings)
    Adds the given sort orderings to the end of this list and returns "this" so it can be chained again.
    Parameters:
      `nextOrderings` - the sort ordering to add
    Returns:
      this (with nextOrderings appended)

  - ### then

    public Orderings then(List<Ordering> nextOrderings)
    Parameters:
      `nextOrderings` - the sort ordering to add
    Returns:
      this
    See Also:
      - `then(Orderings)`

  - ### orderedList

    public <T> List<T> orderedList(Collection<T> objects)
    Returns an list sorted with these Orderings.
    Type Parameters:
      `T` - the type of the list
    Parameters:
      `objects` - elements to sort
    Returns:
      new List with ordered elements

  - ### orderList

    public <T> void orderList(List<T> list)
    Sorts the given array with these Orderings.
    Type Parameters:
      `T` - the type of the list
    Parameters:
      `list` - the list to sort