|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Comparable<T>
Comparable is a feature of classes that define a full order.
| Method Summary | |
|---|---|
int |
compareTo(T o)
compareTo compares this to another object. |
| Method Detail |
|---|
int compareTo(T o)
for any a, b and c that are comparable instance of the same class, the following must hold:
a.compareTo(b) < 0 ==> b.compareTo(a) > 0 a.compareTo(b) > 0 ==> b.compareTo(a) < 0 a.compareTo(b) == 0 ==> b.compareTo(a) == 0
a.compareTo(b) == 0 && a.compareTo(c) < 0 ==> b.compareTo(c) < 0 a.compareTo(b) == 0 && a.compareTo(c) > 0 ==> b.compareTo(c) > 0 a.compareTo(b) == 0 && a.compareTo(c) == 0 ==> b.compareTo(c) == 0
a.compareTo(b) < 0 && b.compareTo(c) < 0 ==> a.compareTo(c) < 0 a.compareTo(b) > 0 && b.compareTo(c) > 0 ==> a.compareTo(c) > 0
o - the other object
ClassCastException - may be thrown if o is not of the same
class as this.
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||