scala

trait Ordered

[source: scala/Ordered.scala]

trait Ordered[A]
extends java.lang.Comparable[A] with AnyRef
A trait for totally ordered data. Note that since version 2006-07-24 this trait is no longer covariant in a. It is important that the equals method for an instance of Ordered[A] be consistent with the compare method. However, due to limitations inherent in the type erasure semantics, there is no reasonable way to provide a default implementation of equality for instances of Ordered[A]. Therefore, if you need to be able to use equality on an instance of Ordered[A] you must provide it yourself either when inheiriting or instantiating. It is important that the hashCode method for an instance of Ordered[A] be consistent with the compare method. However, it is not possible to provide a sensible default implementation. Therefore, if you need to be able compute the hash of an instance of Ordered[A] you must provide it yourself either when inheiriting or instantiating.
Author
Martin Odersky
Version
1.1, 2006-07-24
Direct Known Subclasses:
Enumeration.Value, RichBoolean, RichByte, RichChar, RichDouble, RichFloat, RichInt, RichLong, RichShort, RichString

Method Summary
def < (that : A) : Boolean
def <= (that : A) : Boolean
def > (that : A) : Boolean
def >= (that : A) : Boolean
abstract def compare (that : A) : Int
Result of comparing this with operand that. returns x where x < 0 iff this < that x == 0 iff this == that x > 0 iff this > that
def compareTo (that : A) : Int
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
abstract def compare(that : A) : Int
Result of comparing this with operand that. returns x where x < 0 iff this < that x == 0 iff this == that x > 0 iff this > that

def <(that : A) : Boolean

def >(that : A) : Boolean

def <=(that : A) : Boolean

def >=(that : A) : Boolean

def compareTo(that : A) : Int
Overrides
java.lang.Comparable.java.lang.Comparable.compareTo