how to compare two hash maps?

后端 未结 7 1052
独厮守ぢ
独厮守ぢ 2021-02-08 02:22

How to compare the values in both hash maps with the help of keys ? Since the keys are identical whereas values are\'nt. and return boolean result for each key comparision. like

7条回答
  •  天涯浪人
    2021-02-08 02:46

    You can take keys of one map (with keySet() method), iterate through them, get values from both maps (with get() method), and compare them.

    Also, you can use values() method to get all key-value pairs form one map, iterate through it and compare values with values from another map.

提交回复
热议问题