The general contract for values whose magnitude can be
compared. Comparable
imposes a total ordering upon
instances of any type that satisfies the interface.
If a type T
satisfies Comparable<T>
, then instances
of T
may be compared using the comparison operators
<
, >
, <=
, >=
, and <=>
.
The total order of a type must be consistent with the definition of equality for the type. That is, there are three mutually exclusive possibilities:
x<y
,x>y
, orx==y
Methods | |
compare | Source Code Compares this value with the given value. Implementations must respect the constraints that:
See also: equals |
Inherited Methods |
Methods inherited from: Object |