Compares the two specified maps for equality. Returns
true if the two maps represent the same mappings. More formally, two maps
m1 and
m2 represent the same mappings if
m1.keySet().equals(m2.keySet()) and for every key
k
in
m1.keySet(),
(m1.get(k)==null ? m2.get(k)==null :
m1.get(k).equals(m2.get(k))) .
This implementation first checks if the
m1 and
m2 are the same object;
if so it returns
true. Then, it checks if the two maps have the same sizw; if
not, it returns
false. If so, it iterates over
m1's
entrySet collection, and checks that map
m1
contains each mapping that map
m2 contains. If map
m1
fails to contain such a mapping,
false is returned. If the
iteration completes,
true is returned.