Java中ArrayList去除重复元素
作者:互联网
Java中ArrayList去除重复元素
//删除ArrayList中重复元素
public static void removeDuplicate(ArrayList<ForCytoLevel3> list) {
for ( int i = 0 ; i < list.size() - 1 ; i ++ ) {
for ( int j = list.size() - 1 ; j > i; j -- ) {
ForCytoLevel3 jjj =(ForCytoLevel3)list.get(j);
ForCytoLevel3 iii =(ForCytoLevel3)list.get(i);
if ( iii.getData().getId().equals(jjj.getData().getId() )) {
list.remove(j);
}
}
}
System.out.println(list);
}
标签:Java,int,ArrayList,list,jjj,去除,ForCytoLevel3 来源: https://www.cnblogs.com/emanlee/p/14075743.html