Java EnumMap equals() methodThe equals() method of Java EnumMap class is used to compare two maps for equality. This method basically compares the passed object with this EnumMap object. SyntaxParameterso - the object to be compared for equality with this map. ReturnsThis method returns true if the specified object is equal to this map. ExceptionNA Example 1Test it NowOutput: Map1:{CSS=1, Python=2, PHP=3, Java=4} Map2:{CSS=1, Python=2, PHP=3, Java=4} Map1 and Map 2 are equal: true Map1 and Map 2 are equal: false Example 2Test it NowOutput: Map1:{Monday=1, Tuesday=2, Wednesday=3} Map2:{Monday=1, Tuesday=2, Wednesday=3} Map1 and Map 2 are equal: true Map1 and Map 2 are equal: false
Next TopicJava EnumMap
|