package net.test;
import java.util.*;
public class Stringlist {
String str;
public void Addlist(){
List<String> po=new ArrayList<String>();
int y;
Random random=new Random();
y=random.nextInt(9)+1;
for (int i=0;i<10;i++){
StringBuffer str=new StringBuffer();
for (int j=0;j<y;j++){
int x;
x=random.nextInt(75)+48;
if (x>57&&x<65||x>90&&x<97){
continue;
}
char m=(char)x;
str.append(m);
}
po.add(str.toString());
}
System.out.println("----------排序前---------");
for (String obj:po){
System.out.println(obj);
}
System.out.println("----------排序后---------");
Collections.sort(po);
for (String obj:po){
System.out.println(obj);
}
}
public static void main(String[] args){
Stringlist stringlist=new Stringlist();
stringlist.Addlist();
}
}