org.gerweck.scala.util.UniversalOrdering.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gerweck-utils-java6_2.11 Show documentation
Show all versions of gerweck-utils-java6_2.11 Show documentation
General utilies for Scala applications
The newest version!
package org.gerweck.scala.util
trait UniversalOrdering[A <: UniversalOrdering.SmartComparable[A]] extends Any with Ordered[A] {
def inner: A
@inline override def compare(that: A) = inner compareTo that
@inline def max (that: A): A = if (this < that) that else inner
@inline def min (that: A): A = if (this < that) inner else that
}
object UniversalOrdering {
type SmartComparable[A] = Comparable[B] forSome { type B >: A }
}