如何获得两个地图Java之间的差异?
本文介绍了如何获得两个地图Java之间的差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两张地图如下:
我想获得与每个地图不同的键.即
I want to get the keys differ from each of the maps.i.e.
- 它显示 sourceRecords 中可用但 targetRecords 中不可用的映射键.
- 它显示 targetRecords 中可用但 sourceRecords 中不可用的映射键.
我是这样做的:
编辑
我能够找到公共键,但不能找到不同的键.请帮忙.
I am able to find the common keys but not distinct keys. Please help.
推荐答案
集合也允许您删除元素.
如果生成帮助"集对您来说不是问题(因为条目太多;那么:
If generating "helper" sets is not a problem for you (because of too many entries; what about:
然后:
而
您可以从这里开始工作......
You can work your way from here ...
这篇关于如何获得两个地图Java之间的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!