码迷,mamicode.com
首页 > 其他好文 > 详细

TreeSet存放ArrayList并去重(去重:所有元素完全一致)

时间:2017-04-27 17:55:00      阅读:255      评论:0      收藏:0      [点我收藏+]

标签:com   new t   ring   system   tree   new   for   array   treeset   

//定义集合
TreeSet<ArrayList<String>>set = new TreeSet<ArrayList<String>>(new Comparator<ArrayList<String>>() {
public int compare(ArrayList<String> o1, ArrayList<String> o2) {
System.out.println("1+");
int flag = 0;

for (String temp: o1) {
if(!o2.contains(temp)){
flag =1;
break;
}
}
for (String temp: o2) {
if(!o1.contains(temp)){
flag =1;
break;
}
}
return flag;
}
});

TreeSet存放ArrayList并去重(去重:所有元素完全一致)

标签:com   new t   ring   system   tree   new   for   array   treeset   

原文地址:http://www.cnblogs.com/wahy/p/6775248.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!