LowPriorityOrderingImplicits

class Object
trait Matchable
class Any
object Ordering

Type members

Types

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

Implicits

Implicits

implicit def comparatorToOrdering[A](cmp: Comparator[A]): Ordering[A]
implicit def ordered[A](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.