public interface Comparable<T>
java.util.Arrays#sortcan then be used to automatically sort lists of classes that implement this interface.
The order rule must be both transitive (if
x.compareTo(y) < 0 and
y.compareTo(z) < 0, then
x.compareTo(z) < 0 must hold) and
invertible (the sign of the result of x.compareTo(y) must be equal to the
negation of the sign of the result of y.compareTo(x) for all combinations of
x and y).
In addition, it is recommended (but not required) that if and only if the
result of x.compareTo(y) is zero, then the result of x.equals(y) should be
int compareTo(T another)
another- the object to compare to this instance.
another; a positive integer if this instance is greater than
another; 0 if this instance has the same order as
anothercannot be converted into something comparable to