名字排序
Topic source不错,但写反了。你的是从低到高的顺序。
return new Integer(other.score).compareTo(new Integer(this.score));//按照score从高到低排序
public int compareTo(Person other) {
return ((Integer)other.score).compareTo((Integer)this.score);
}
public int compareTo(Person other) {
return (Integer.valueOf(other.score)).compareTo(Integer.valueOf(this.score));
}
这种写法应该更好~
- 1
用户5974420524
public int compareTo(Person other) {
return new Integer(this.score).compareTo(new Integer(other.score));
}