package com.sino.service.shop.impl;
import java.util.TreeSet;
class QuChong {
public static void main(String[] args) {
TreeSet<String> tr = new TreeSet<String>();
String[] s ={"11","22","22","33","33","33"};
System.out.print("====处理前=======");
for(int i=0;i<s.length;i++){
System.out.print(s[i]+" ");
tr.add(s[i]);
}
s2[i]=tr.pollFirst();//从TreeSet中取出元素重新赋给数组
System.out.print(s2[i]+" ");
}
}
}
import java.util.TreeSet;
class QuChong {
public static void main(String[] args) {
TreeSet<String> tr = new TreeSet<String>();
String[] s ={"11","22","22","33","33","33"};
System.out.print("====处理前=======");
for(int i=0;i<s.length;i++){
System.out.print(s[i]+" ");
tr.add(s[i]);
}
String[] s2= new String[tr.size()];
System.out.println("=====处理后======");
for(int i=0;i<s2.length;i++){s2[i]=tr.pollFirst();//从TreeSet中取出元素重新赋给数组
System.out.print(s2[i]+" ");
}
}
}