跳至主要內容

sort your array (java)

Last Updated on 2011-09-06 by william

1:
ArrayList aArrayList = new ArrayList

2:
public YourClass implements Comparator {


private int id;
public int getID(){
return id;
}
public int compare(YourClass o) {
return this.getID()-o.getID();
}
}

3:
Collections.sort(aArrayList );

分類:技術

搶先發佈留言

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

由 Compete Themes 設計的 Author 佈景主題