Comparing two hashmaps for equal values and same key sets?

后端 未结 6 959
北荒
北荒 2020-12-03 02:18

How can I best compare two HashMaps, if I want to find out if none of them contains different keys than the other, and if the values of that keys match each oth

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 03:04

    Simply use :

    mapA.equals(mapB);

    Compares the specified object with this map for equality. Returns true if the given object is also a map and the two maps represent the same mappings

提交回复
热议问题