# Order<T> class abstract

The `Order` type class is used to define a total ordering on some type `A`.

An order is defined by a relation <=, which obeys the following laws:

• either `x <= y` or `y <= x` (totality)
• if `x <= y` and `y <= x`, then `x == y` (antisymmetry)
• if `x <= y` and `y <= z`, then `x <= z` (transitivity)

The truth table for compare is defined as follows:

x <= y x >= y int
true true = 0 (corresponds to x == y)
true false < 0 (corresponds to x < y)
false true > 0 (corresponds to x > y)

By the totality law, `x <= y` and `y <= x` cannot be both false.

Inheritance

Order()
const

## Properties

hashCode int
The hash code for this object.
reverse Order<T>
Return an Order reversed.
runtimeType Type
A representation of the runtime type of the object.

## Methods

and(Eq<T> eq) Eq<T>
Return an `Eq` that gives the result of and of `eq1` and `eq2`.
inherited
between(T min, T max, T value) bool
Test whether `value` is between `min` and `max` (inclusive).
clamp(T min, T max, T value) → T
Clamp `value` between `min` and `max`.
compare(T x, T y) int
Result of comparing `x` with `y`. Returns an Int whose sign is:
contramap<A>(T map(A)) Order<A>
Return an Order instance based on a parameter of type `T` extracted from a class `A`.
override
eqv(T x, T y) bool
Returns `true` if `x` == `y`, `false` otherwise.
override
gt(T x, T y) bool
Returns `true` if `x` > `y`, `false` otherwise.
override
gteqv(T x, T y) bool
Returns `true` if `x` >= `y`, `false` otherwise.
override
lt(T x, T y) bool
Returns `true` if `x` < `y`, `false` otherwise.
override
lteqv(T x, T y) bool
Returns `true` if `x` <= `y`, `false` otherwise.
override
max(T x, T y) → T
If `x > y`, return `x`, else return `y`.
min(T x, T y) → T
If `x < y`, return `x`, else return `y`.
neqv(T x, T y) bool
Returns `false` if `x` and `y` are equivalent, `true` otherwise.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
or(Eq<T> eq) Eq<T>
Return an `Eq` that gives the result of or of this Eq and `eq`.
inherited
partialCompare(T x, T y)
Result of comparing `x` with `y`.
override
toString()
A string representation of this object.
inherited
xor(Eq<T> eq) Eq<T>
Return an `Eq` that gives the result of xor of this Eq and `eq`.
inherited

## Operators

operator ==(Object other) bool
The equality operator.
inherited

## Static Properties

orderDate
Instance of `Order` for `DateTime`.
orderDouble Order<double>
Instance of `Order` for `double`.
orderInt Order<int>
Instance of `Order` for `int`.
orderNum Order<num>
Instance of `Order` for `num`.

## Static Methods

allEqual<A>() Order<A>
An `Order` instance that considers all `A` instances to be equal (`compare` always returns `0`).
override
by<A, B>(B f(A a), Order<B> ord) Order<A>
Convert an implicit `Order<B>` to an `Order<A>` using the given function `f`.
override
from<A>(int f(A a1, A a2)) Order<A>
Define an `Order<A>` using the given function `f`.
override
fromLessThan<A>(bool f(A a1, A a2)) Order<A>
Define an `Order<A>` using the given 'less than' function `f`.
whenEqual<A>(Order<A> first, Order<A> second) Order<A>
Returns a new `Order<A>` instance that first compares by the first `Order` instance and uses the second `Order` instance to "break ties".