/**
@param args
*/
public void testSort3(){
List<String> stringList = new ArrayList<String>();
Random random = new Random();
String stringBase = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(int i=0; i<10; i++){
String toadd;
do{
StringBuilder sb = new StringBuilder();
int k = random.nextInt(10);
for(int j=0; j<k; j++){
int l = random.nextInt(stringBase.length());
sb.append(stringBase.charAt(l));
}
toadd = sb.toString();
}while(stringList.contains(toadd));
System.out.println("添加了元素:" + toadd);
stringList.add(toadd);
}
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);
}
}
2025 - 快车库 - 我的知识库 重庆启连科技有限公司 渝ICP备16002641号-10
企客连连 表单助手 企服开发 榜单123