前端优化网站,对于高校类建设网站的要求,网络游戏吧,网站网络建设原课程地址https://www.imooc.com/video/4254* 扩展练习要求* 利用Collections.sort()方法对泛型为String的List进行排序版本2* 1.创建完List之后#xff0c;往其中添加10条随机字符串* 2.每条字符串的长度为10以内的随机整数* 3.每条字符串的每个字符都是随机生成的#xff…原课程地址https://www.imooc.com/video/4254* 扩展练习要求* 利用Collections.sort()方法对泛型为String的List进行排序版本2* 1.创建完List之后往其中添加10条随机字符串* 2.每条字符串的长度为10以内的随机整数* 3.每条字符串的每个字符都是随机生成的字符可重复* 4.每条随机字符串不可重复下面是我写的方法需要放入一个测试类中并在main函数中运行。(Collections.sort()自然排序是按照ASCII值排序)运行结果-----------------排序前------------------Qa6gcd IMK qU6m oeBJZ P XcpN u0CY AdRsq CvP 8D7i-----------------排序后------------------8D7i AdRsq CvP IMK P Qa6gcd XcpN oeBJZ qU6m u0CYpublic void testSort2(){List stringList new ArrayList();Random r new Random();String str 0123456789QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm;for(int i0; i10; i){String strNew new String();do{strNew ;for(int j0; jstrNewstr.charAt(r.nextInt(str.length()));}}while(stringList.contains(strNew));stringList.add(strNew);}System.out.println(-----------------排序前------------------);for(String string:stringList){System.out.print(string );}Collections.sort(stringList);System.out.println();System.out.println(-----------------排序后------------------);for(String string:stringList){System.out.print(string );}}