public class Bean implements Comparable {
…
…
@Override
public int compareTo(Bean_oneExp o) {
if(this.timestamp != o.getTimestamp()){
return (int)(this.timestamp – o.getTimestamp());//按照timestamp 升序
}else{
return this.location – o.location;
}
}
Collections.sort(exp_lst); // list里放的Bean对象