📅  最后修改于: 2022-03-11 14:52:15.963000             🧑  作者: Mango
HashMap f1 = new HashMap();
HashMap f2 = new HashMap();
// read f1, f2; use PK field as the key
List deleted = new ArrayList();
List updated = new ArrayList();
for(Map.Entry entry : f1.keySet()) {
if(!f2.containsKey(entry.getKey()) {
deleted.add(entry.getValue());
} else {
if(!f2.get(entry.getKey().equals(f1.getValue())) {
updated.add(f1.getValue());
}
}
}
for(String key : f1.keySet()) {
f2.remove(key);
}
// f2 now contains only "new" rows