List<T> listT;
... // add item to listT
Collections.sort(listT);
-----------------------------------
public class T implements Comparable<T> {
@Override
public int compareTo(T t) {
return somting.compareTo(t.getSomting());
}
}
... // add item to listT
Collections.sort(listT);
-----------------------------------
public class T implements Comparable<T> {
@Override
public int compareTo(T t) {
return somting.compareTo(t.getSomting());
}
}
댓글
댓글 쓰기