compareTo 抽象方法
- T other
比较此对象与另一个对象。
返回一个值,类似于 Comparator 当比较 this 和 other 时。也就是说,如果 this 在 other 之前排序,则返回一个负整数;如果 this 在 other 之后排序,则返回一个正整数;如果 this 和 other 排序相同,则返回零。
other 参数必须是一个可以与此对象比较的值。
实现
int compareTo(T other);
比较此对象与另一个对象。
返回一个值,类似于 Comparator 当比较 this 和 other 时。也就是说,如果 this 在 other 之前排序,则返回一个负整数;如果 this 在 other 之后排序,则返回一个正整数;如果 this 和 other 排序相同,则返回零。
other 参数必须是一个可以与此对象比较的值。
int compareTo(T other);