import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CollectionsSortStringList {
public static void main(String[] args){
CollectionsSortStringList cl = new CollectionsSortStringList();
cl.sortStringList();
}
public void sortStringList(){
String str = "258398364358kjngdflbndfknSNRFONRFOLKNFOLNF";
List<String> list = new ArrayList<String>();
for(int j = 0;j < 10;j++) {
String s = "";
for (int i = 0; i < (Math.random()*10); i++) {
char k = str.charAt((int) (Math.random() * (str.length() - 1)));
s = s + k;
}
list.add(s);
}
System.out.println("排序前------------------");
for (String l:list) {
System.out.println(l);
}
System.out.println("排序后------------------");
Collections.sort(list);
for (String l:list) {
System.out.println(l);
}
}
}