Trait/Object

cats.kernel

Order

Related Docs: object Order | package kernel

Permalink

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]
Linear Supertypes
PartialOrder[A], Eq[A], Serializable, Serializable, Any
Known Subclasses
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

    Permalink

    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[_]

    Permalink
    Definition Classes
    Any

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. def and(that: Eq[A]): Eq[A]

    Permalink

    Return an Eq that gives the result of the and of this and that note this is idempotent

    Return an Eq that gives the result of the and of this and that note this is idempotent

    Definition Classes
    Eq
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def comparison(x: A, y: A): Comparison

    Permalink

    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.

  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  8. def eqv(x: A, y: A): Boolean

    Permalink

    Returns true if x = y, false otherwise.

    Returns true if x = y, false otherwise.

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

    Permalink

    Returns true if x > y, false otherwise.

    Returns true if x > y, false otherwise.

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

    Permalink

    Returns true if x >= y, false otherwise.

    Returns true if x >= y, false otherwise.

    Definition Classes
    OrderPartialOrder
  11. def hashCode(): Int

    Permalink
    Definition Classes
    Any
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. def lt(x: A, y: A): Boolean

    Permalink

    Returns true if x < y, false otherwise.

    Returns true if x < y, false otherwise.

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

    Permalink

    Returns true if x <= y, false otherwise.

    Returns true if x <= y, false otherwise.

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

    Permalink

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

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

    Permalink

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

  17. def neqv(x: A, y: A): Boolean

    Permalink

    Returns true if x != y, false otherwise.

    Returns true if x != y, false otherwise.

    Definition Classes
    OrderEq
  18. def on[B](f: (B) ⇒ A): Order[B]

    Permalink

    Defines an order on B by mapping B to A using f and using As order to order B.

    Defines an order on B by mapping B to A using f and using As order to order B.

    Definition Classes
    OrderPartialOrderEq
  19. def or(that: Eq[A]): Eq[A]

    Permalink

    Return an Eq that gives the result of the or of this and that Note this is idempotent

    Return an Eq that gives the result of the or of this and that Note this is idempotent

    Definition Classes
    Eq
  20. def partialCompare(x: A, y: A): Double

    Permalink

    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
  21. def partialComparison(x: A, y: A): Option[Comparison]

    Permalink

    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
  22. def pmax(x: A, y: A): Option[A]

    Permalink

    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
  23. def pmin(x: A, y: A): Option[A]

    Permalink

    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
  24. def reverse: Order[A]

    Permalink

    Defines an ordering on A where all arrows switch direction.

    Defines an ordering on A where all arrows switch direction.

    Definition Classes
    OrderPartialOrder
  25. def toOrdering: Ordering[A]

    Permalink

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

  26. def toString(): String

    Permalink
    Definition Classes
    Any
  27. def tryCompare(x: A, y: A): Option[Int]

    Permalink

    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
  28. def whenEqual(o: Order[A]): Order[A]

    Permalink

    Returns a new Order[A] instance that first compares by the original Order instance and uses the provided Order instance to "break ties".

    Returns a new Order[A] instance that first compares by the original Order instance and uses the provided Order instance to "break ties".

    That is, x.whenEqual(y) creates an Order that first orders by x and then (if two elements are equal) falls back to y for the comparison.

Inherited from PartialOrder[A]

Inherited from Eq[A]

Inherited from Serializable

Inherited from Serializable

Inherited from Any

Ungrouped