public static void paixu(List<String> list) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.size(); i++) {
for (int j = i; j < list.size(); j++) {
if ((list.get(i)).compareTo(list.get(j)) > 0) {
sb.delete(0, sb.length());
sb.append(list.get(i));
list.set(i, list.get(j));
list.set(j, sb.toString());
}
}
}
}
这样可以不! |