t

# Order 

### Companion object Order

#### trait Order[A] extends PartialOrder[A]

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.

Self Type
Order[A]
Source
Order.scala
Linear Supertypes
PartialOrder[A], Eq[A], Serializable, Serializable, Any
Ordering
1. Alphabetic
2. By Inheritance
Inherited
1. Order
2. PartialOrder
3. Eq
4. Serializable
5. Serializable
6. Any
1. Hide All
2. Show All
Visibility
1. Public
2. All

### Abstract Value Members

1. abstract def compare(x: A, y: A): Int

Result of comparing `x` with `y`.

Result of comparing `x` with `y`. Returns an Int whose sign is: - negative iff `x < y` - zero iff `x = y` - positive iff `x > y`

2. abstract def getClass(): Class[_]
Definition Classes
Any

### Concrete Value Members

1. final def !=(arg0: Any)
Definition Classes
Any
2. final def ##(): Int
Definition Classes
Any
3. final def ==(arg0: Any)
Definition Classes
Any
4. final def asInstanceOf[T0]: T0
Definition Classes
Any
5. def comparison(x: A, y: A)

Like `compare`, but returns a cats.kernel.Comparison instead of an Int.

Like `compare`, but returns a cats.kernel.Comparison instead of an Int. Has the benefit of being able to pattern match on, but not as performant.

6. def equals(arg0: Any)
Definition Classes
Any
7. def eqv(x: A, y: A)

Returns true if `x` = `y`, false otherwise.

Returns true if `x` = `y`, false otherwise.

Definition Classes
OrderPartialOrderEq
8. def gt(x: A, y: A)

Returns true if `x` > `y`, false otherwise.

Returns true if `x` > `y`, false otherwise.

Definition Classes
OrderPartialOrder
9. def gteqv(x: A, y: A)

Returns true if `x` >= `y`, false otherwise.

Returns true if `x` >= `y`, false otherwise.

Definition Classes
OrderPartialOrder
10. def hashCode(): Int
Definition Classes
Any
11. final def isInstanceOf[T0]
Definition Classes
Any
12. def lt(x: A, y: A)

Returns true if `x` < `y`, false otherwise.

Returns true if `x` < `y`, false otherwise.

Definition Classes
OrderPartialOrder
13. def lteqv(x: A, y: A)

Returns true if `x` <= `y`, false otherwise.

Returns true if `x` <= `y`, false otherwise.

Definition Classes
OrderPartialOrder
14. def max(x: A, y: A): A

If x > y, return x, else return y.

15. def min(x: A, y: A): A

If x < y, return x, else return y.

16. def neqv(x: A, y: A)

Returns true if `x` != `y`, false otherwise.

Returns true if `x` != `y`, false otherwise.

Note: this default implementation provided by Order is the same as the one defined in Eq, but for purposes of binary compatibility, the override in Order has not yet been removed. See this discussion.

Definition Classes
OrderEq
17. def partialCompare(x: A, y: A)

Result of comparing `x` with `y`.

Result of comparing `x` with `y`. Returns NaN if operands are not comparable. If operands are comparable, returns a Double whose sign is:

• negative iff `x < y`
• zero iff `x = y`
• positive iff `x > y`
Definition Classes
OrderPartialOrder
18. def partialComparison(x: A, y: A)

Like `partialCompare`, but returns a cats.kernel.Comparison instead of an Double.

Like `partialCompare`, but returns a cats.kernel.Comparison instead of an Double. Has the benefit of being able to pattern match on, but not as performant.

Definition Classes
PartialOrder
19. def pmax(x: A, y: A): Option[A]

Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.

Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.

Definition Classes
PartialOrder
20. def pmin(x: A, y: A): Option[A]

Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.

Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.

Definition Classes
PartialOrder
21. def toOrdering: Ordering[A]

Convert a `Order[A]` to a `scala.math.Ordering[A]` instance.

22. def toString(): String
Definition Classes
Any
23. def tryCompare(x: A, y: A): Option[Int]

Result of comparing `x` with `y`.

Result of comparing `x` with `y`. Returns None if operands are not comparable. If operands are comparable, returns Some[Int] where the Int sign is:

• negative iff `x < y`
• zero iff `x = y`
• positive iff `x > y`
Definition Classes
PartialOrder