package project;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class Test {
public static void main(String[] args) {
Random random = new Random();
//String st;
List<String> list = new ArrayList<String>();
String arrays = "ZXCVBNMASDFGHJKLQWERTYUIOPzxcvbnmasdfghjklpoiuytrewq0123456789";
int num = random.nextInt(10);
for(int i = 0;i < num;i++){
String st;
StringBuffer str = new StringBuffer();
int nume = random.nextInt(10);
do{
for(int j = 0;j < nume;j++){
int at = random.nextInt(61);
str.append(arrays.charAt(at));
}
st = str.toString();
}while(list.contains(st));
list.add(st);
}
System.out.println("排序前的list中的元素");
for (String string : list) {
System.out.println(string);
}
Collections.sort(list);
System.out.println("排序后的序列");
for (String string : list) {
System.out.println(string);
}
}
}