An object containing implicits which are not in the default scope.
Given f, a function from T into S, creates an Ordering[T] whose compare function is equivalent to:
Given f, a function from T into S, creates an Ordering[T] whose compare function is equivalent to:
def compare(x:T, y:T) = Ordering[S].compare(f(x), f(y))
This function is an analogue to Ordering.on where the Ordering[S] parameter is passed implicitly.
Construct an Ordering[T] given a function lt
.
This would conflict with all the nice implicit Orderings
available, but thanks to the magic of prioritized implicits
via subclassing we can make Ordered[A] => Ordering[A]
only
turn up if nothing else works.
This would conflict with all the nice implicit Orderings
available, but thanks to the magic of prioritized implicits
via subclassing we can make Ordered[A] => Ordering[A]
only
turn up if nothing else works. Since Ordered[A]
extends
Comparable[A]
anyway, we can throw in some Java interop too.
This is the companion object for the scala.math.Ordering trait.
It contains many implicit orderings as well as well as methods to construct new orderings.