*/
public void testsort3(){
List stringList=new ArrayList();
String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Random random=new Random();
StringBuffer sb= new StringBuffer();
int i=0,j=0,length;
for( i=0;i<10;){
length=random.nextInt(11);
if(sb!=null)
sb=new StringBuffer();
for( j=0;j
{
int number=random.nextInt(62);
sb.append(str.charAt(number));
}
if(!stringList.contains(sb.toString()))
{
System.out.println("将要添加的字符串:'"+sb.toString()+"'");
stringList.add(sb.toString());
i++;
}
}
System.out.println("----------------排序前-------------------");
for(String string:stringList)
{
System.out.println("元素:"+string);
}
Collections.sort(stringList);
System.out.println("-----------------排序后------------------");
for(String string:stringList)
{
System.out.println("元素:"+string);
}
}