Comparable
public class Employee implements Comparable<Employee> {
int age;
@Override
public int compareTo(Employee o) {
// 优雅 优雅,舒服了!!
return this.age - o.age;
}
}
public class Employee implements Comparable<Employee> {
int age;
@Override
public int compareTo(Employee o) {
// 优雅 优雅,舒服了!!
return this.age - o.age;
}
}
相关推荐