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);