I’m using some java.util.Date (which implements java.lang.Comparable) and would like to be able to use it nicely, e.g. use < and >= instead of “compareTo(other) == 1”. Is there a nice way to just easily mix in something like scala.math.Ordered without a lot of boiler plate?
I’m using some java.util.Date (which implements java.lang.Comparable) and would like to be able to
Share
In the Ordering companion object there is an implicit conversion from Comparable[A] to Ordering[A]. So you can do this: