Ordered and Ordering
Java关于比较有两个基础接口:Comparable,Comparator。
其中Comparatable接口只定义了一个方法
public int compareTo(T o);
而Comparator相对复杂:
int compare(T o1, T o2);
thenComparing() ...
Scala与之对应的比较是Ordered,Ordering。
Ordered类似Comparable,并多出
https://www.scala-lang.org/api/current/scala/math/Ordering.html
This trait and scala.math.Ordered both provide this same functionality, but in different ways. A type T can be given a single way to order itself by extending Ordered. Using Ordering, this same type may be sorted in many other ways. Ordered and Ordering both provide implicits allowing them to be used interchangeably.