更新时间:2022-03-16 04:51:56
public class Person implements Comparable<Person>{ public int compareTo(Person otherPerson ){ Long otherPersonId=otherPerson.getPersonId(); int value=1; if (otherPersonId!=null&&this.getPersonId()!=null){ if(this.personId<otherPersonId){ value=-1; }else if(***){ 此处省略..... } return value; } }
List personList<Person>=getPersonList(); Collections.sort(personList);