public class testList {
public static void main(String[] args){
java.util.List<String> ls = new java.util.ArrayList<>();
ls.add("A");
ls.add("B");
ls.add("C");
String[] str = {"A","B","C","D"};
for(int i=0;i<str.length;i++){
ls.add(str[i]);
}
java.util.Set<String> set = new java.util.TreeSet<>(ls);
java.util.List<String> lsr = new java.util.ArrayList<>();
lsr.addAll(set);
System.out.println(lsr.toString());
}
}
打印结果:[A, B, C, D]