我有2个地图。
HashMap<DedupeTableEntity,List<DedupeTableEntity>> deltaHashmap
HashMap<DedupeTableEntity,List<DedupeTableEntity>> existingHashmap
残疾者具有id、国家、实体。
I want to iterate through the values of delta hash map (both hashmaps has only 1 key and list of values under that key)
Check whether that object is in existing hash map if 2 attributes match (country and id)
如果有
Take attribute value of (entity flag) that object from existinghashmap and replace the attribute (entity flag) value of the same object in the delta hash map
public void compareTwoHashmaps(HashMap<DedupeTableEntity,List<DedupeTableEntity>> deltaHashmap , HashMap<DedupeTableEntity,List<DedupeTableEntity>> existingHashmap){ //iterate through deltahashmap values return deltaHashmap.values().stream() .flatMap(Collection::stream) .filter(c -> (existingHashmap.values().stream().flatMap(Collection::stream).filter(e->e.getId().equals(c.getId()) && e.getObjectCountry().equals(c.getObjectCountry()))) .map(k-> k.setEntityFlag(existingHashmap.values().stream().flatMap(Collection::stream).filter(e->e.getId().equals(k.getId()) && e.getObjectCountry().equals(k.getObjectCountry())).map(r ->r.getEntityFlag()).toString())); }
这是我迄今为止所走过的。 但有一个错误,即:如何纠正。
希望得到任何帮助。