groovy.util

## Class OrderBy<T>

- java.lang.Object
- - groovy.util.OrderBy<T>

- All Implemented Interfaces:
    java.io.Serializable, java.util.Comparator<T>

      public class OrderBy<T>
      extends java.lang.Object
      implements java.util.Comparator<T>, java.io.Serializable

  A helper class for sorting objects via a closure to return the field or operation on which to sort.
  Author:
    James Strachan
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OrderBy()`
    `OrderBy(boolean equalityCheck)`
    `OrderBy(Closure closure)`
    `OrderBy(Closure closure, boolean equalityCheck)`
    `OrderBy(java.util.List<Closure> closures)`
    `OrderBy(java.util.List<Closure> closures, boolean equalityCheck)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Closure closure)`
    `int` | `compare(T object1, T object2)`
    `boolean` | `isEqualityCheck()`
    `void` | `setEqualityCheck(boolean equalityCheck)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### OrderBy

          public OrderBy()

    - #### OrderBy

          public OrderBy(boolean equalityCheck)

    - #### OrderBy

          public OrderBy(Closure closure)

    - #### OrderBy

          public OrderBy(Closure closure,
                         boolean equalityCheck)

    - #### OrderBy

          public OrderBy(java.util.List<Closure> closures)

    - #### OrderBy

          public OrderBy(java.util.List<Closure> closures,
                         boolean equalityCheck)

  - ### Method Detail

    - #### add

          public void add(Closure closure)

    - #### compare

          public int compare(T object1,
                             T object2)

      Specified by:
        `compare` in interface `java.util.Comparator<T>`

    - #### isEqualityCheck

          public boolean isEqualityCheck()

    - #### setEqualityCheck

          public void setEqualityCheck(boolean equalityCheck)