Pet*_*rey 10
提供比较例如
Collections.sort(list, new Comparator<MyType>() {
public int compareTo(MyType t1, MyType t2) {
return t1.age - t2.age;
}
}
Run Code Online (Sandbox Code Playgroud)
如果年龄可能很大,这不安全,但我认为年龄将在0到20亿之间.;)
| 归档时间: |
|
| 查看次数: |
2955 次 |
| 最近记录: |