//按分数从小到大顺序排序 如果 分数 一样 按姓名字典顺序 排序
@Override public int compareTo(Person other) {
int score = this.score - other.score;
if (score == 0) { score = this.name.compareTo(other.name); }
return score; }
现在也不明白当时的脑回路是什么了.为什么要这样写.
现在看,如行云流水,和呼吸一样自然。。。
我觉得这可能和人的本能有关系,对陌生的事物莫名的害怕,见多了,也就那样
Sign in to make a reply
求女票上微博
//按分数从小到大顺序排序 如果 分数 一样 按姓名字典顺序 排序
@Override
public int compareTo(Person other) {
int score = this.score - other.score;
if (score == 0) {
score = this.name.compareTo(other.name);
}
return score;
}