sort your array (java)

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 );

發佈留言

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