Math.Ordering

trait Ordering[A] extends scala.Ordering[A]

General Ordering

Note. Scalqa classes do not use this trait directly, but rather its parent scala.math.Ordering

All methods defined here are also available on scala.math.Ordering as extensions.

This trait is usefull for creating new orderings.

Source
__.scala
trait scala.Ordering[A]
trait scala.math.PartialOrdering[A]
trait scala.math.Equiv[A]
trait java.io.Serializable
trait java.util.Comparator[A]
class java.lang.Object
trait scala.Matchable
class Any

Def

@scala.annotation.targetName("_join")
def +(c: scala.Ordering[A]): scala.Ordering[A]

Alias for join

Alias for join

Creates a new Ordering, which will order elements based on this Ordering, and if they appear equal, on joined Ordering

Source
__.scala
override def compare(x: A, y: A): Int

Compare elements

Compare elements

This is the only abstract method to be implemented.

Returns Int value < 0 (usually -1), if first element is less than second.

Returns Int value > 0 (usually 1), if first element is greater than second.

Returns Int value of 0, if two elements are equal.

Definition Classes
Ordering -> Comparator
Source
__.scala
def join(c: scala.Ordering[A]): scala.Ordering[A]

Join

Join

Creates a new Ordering, which will order elements based on this Ordering, and if they appear equal, on joined Ordering

Source
__.scala
override def on[U](f: U => A): scala.Ordering[U]

On type

On type

Creates an ordering on specified type. The mapping function from specified type to current type must be provided.

 val stringOrdering = Ordering[String]

 val intOrdering = stringOrdering.on[Int](i => i.toString)
Definition Classes
Ordering
Source
__.scala
@scala.annotation.targetName("opt_View")
def opt_^(voidPosition: Int): scala.Ordering[Opt[A]]

Opt view

Opt view

Creates an ordering to sort Opt values of current type.

Source
__.scala
@scala.annotation.targetName("rank_View")
def rank_^(fun: A => Int): scala.Ordering[A]

Ranked view

Ranked view

Creates an ordering, where all elements are first ordered on rank (defined with given function) and than on merit.

Source
__.scala
override def reverse: scala.Ordering[A]

Reversed ordering

Reversed ordering

Returns ordering with reversed order

Definition Classes
Ordering -> PartialOrdering
Source
__.scala
@scala.annotation.targetName("voidFirst_View")
def voidFirst_^(using Given.VoidTag[A]): scala.Ordering[A]

Void first view

Void first view

Creates an ordering, where all void elements will come first.

Source
__.scala
@scala.annotation.targetName("voidLast_View")
def voidLast_^(using Given.VoidTag[A]): scala.Ordering[A]

Void last view

Void last view

Creates an ordering, where all void elements will come last.

Source
__.scala

Implicit

Inherited from
Ordering