package test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class StringCompositor1 {
@SuppressWarnings("unchecked")
public static void main(String[] args) {
System.out.print("数组中的[数字]排序:");
String[] str = {"3","4","1","2","6","7","5"};
Arrays.sort(str);
for(int i=0;i<str.length;i++){
System.out.print(str[i]+",");
}
System.out.println();
System.out.print("数组中的[字符]排序:");
String[] str2 = {"a","ce","b","bf","fs","cz","ac"};
Arrays.sort(str2);
for(int i=0;i<str2.length;i++){
System.out.print(str2[i]+",");
}
System.out.println();
System.out.print("集合中的[数字]排序:");
List list = new ArrayList();
list.add("6");
list.add("5");
list.add("3");
list.add("1");
list.add("4");
list.add("2");
list.add("7");
Collections.sort(list);
for(int i=0;i<list.size();i++){
System.out.print((String)list.get(i)+",");
}
System.out.println();
System.out.print("集合中的[字符]排序:");
List list2 = new ArrayList();
list2.add("b");
list2.add("bg");
list2.add("af");
list2.add("a");
list2.add("ce");
list2.add("cd");
list2.add("q");
Collections.sort(list2);
for(int i=0;i<list2.size();i++){
System.out.print((String)list2.get(i)+",");
}
}
}