<span style="white-space:pre"> </span>StringBuffer s1 = new StringBuffer();
s1.append("a");s1.append(",");s1.append("2");s1.append(",");s1.append("1");
StringBuffer s2 = new StringBuffer();
s2.append("a");s2.append(",");s2.append("1");s2.append(",");s2.append("1");
StringBuffer s3 = new StringBuffer();
s3.append("b");s3.append(",");s3.append("2");s3.append(",");s3.append("2");
StringBuffer s4 = new StringBuffer();
s4.append("b");s4.append(",");s4.append("2");s4.append(",");s4.append("2");
StringBuffer s5 = new StringBuffer();
s5.append("b");s5.append(",");s5.append("2");s5.append(",");s5.append("2");
List<String> list = new ArrayList<String>();
list.add(s1.toString());
list.add(s2.toString());
list.add(s3.toString());
list.add(s4.toString());
list.add(s5.toString());
//System.out.println("---"+list);
TreeSet<String> ts = new TreeSet<String>();
for(int i=0;i<list.size();i++)
{
ts.add(list.get(i));
}
System.out.println("--ts--"+ts);
list<String>去重
最新推荐文章于 2024-07-23 20:07:32 发布