Trait LowPriorityOrderingImplicits.LowPriorityOrderingImplicits
Source code


trait LowPriorityOrderingImplicits




Supertypes

class Object

trait Matchable

class Any




Known subtypes
object Ordering.type


Types

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


Implicits

Source
implicit def comparatorToOrdering[A](implicit cmp: Comparator[A]): Ordering[A]



Source
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. Since Ordered[A] extends Comparable[A] anyway, we can throw in some Java interop too. 


    
{'path': 'public/docs/scala~3.2/scala/math/lowpriorityorderingimplicits.html', 'source': 'DevDocs.IO'}