public static<T> void sort(List<T> list){
for(int i=0; i<list.size()-1; i++){
for(int j=0; j<list.size()-1-i; j++){
T t = list.get(j);
Comparable<T> comparable = (Comparable<T>) t;
if(comparable.compareTo( list.get(j+1) ) > 0 ){
T temp = list.get(j);
list.set(j, list.get(j+1));
list.set(j+1, temp);
}
}
}
} |
|