Given two Ordered vals, I can find maximum using following code:
abstract class C extends Ordered[C] ()
val v1: C = ???
val v2: C = ???
val max = implicitly[Ordering[C]].max(v1, v2)
Can it be done simpler?
If you import Ordering._, you get v1 max v2 (or v1.max(v2), as you might prefer). Also v1 < v2, etc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With