![]() |
VOOZH | about |
The equals() method of the Java AbstractMap class is used to check equality between two maps. It compares the key-value pair in the current map with the key-value pair of the specified map.
public boolean equals(Object o)
Example: This example demonstrates how the equals() method checks for equality between different HashMap instances based on their key-value mapping.
First HashMap: {Geek3=3, Geek2=2, Geek1=1}
Second HashMap: {Geek3=3, Geek2=2, Geek1=1}
Third HashMap: {Geek4=4, Geek2=2, Geek1=1}
Is hm1 equal to hm2? true
Is hm1 equal to hm3? false