網上找的源碼java
public
boolean
retainAll(Collection<?> c){
數據庫
boolean
modified =
false
;
Iterator<E> e = iterator();
while
(e.hasNext()){
if
(!c.contains(e.next())){
e.remove();
modified =
true
;
}
}
return
modified;
}
if(dbCode.containsAll(excelCode)){
return false;
}else{
boolean flag=dbCode.retainAll(excelCode);
if(dbCode.size()==0){
//若是dbCode.size()==0證實dbCode本來集合裏的值和excelCode的值沒一個對應的.
return true;
}
return flag;}