LowPriorityOrderingImplicits

class Object
trait Matchable
class Any
object Ordering.type

Type members

Types

type AsComparable[A] = A => Comparable[_ >: A]

Implicits

Implicits

implicit def comparatorToOrdering[A](implicit cmp: Comparator[A]): Ordering[A]
implicit def ordered[A](implicit asComparable: () => A): Ordering[A]

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.

Source:
Ordering.scala