All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gerweck.scala.util.UniversalOrdering.scala Maven / Gradle / Ivy

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 }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy