Listlist1=new ArrayList ();
Listlist2=new ArrayList ();
for (int i = 0; i < 2000; i++) {
list1.add((int)(Math.random()*1000));
}
for (int i = 0; i < 1000; i++) {
list2.add((int)(Math.random()*1000));
}
list1.retainAll(list2);//获得交集
Setset = new LinkedHashSet ();//去重
set.addAll(list1);
list1.clear();
list1.addAll(set);//去重结束