71
Java Collection equals() Method
The equals() method of Java Collection Interface compares the specified object with this collection for equality.
Syntax
Parameters
The parameter ‘o’ represents the object to be compared for equality with this collection.
Overrides
This method overrides equals in class Object
Return
The equals method returns Boolean value ‘true’ if the specified object is equal to this collection else it returns false.
Example 1
Output:
true
Example 2
Output:
Equals methods will return : false
Next TopicJava Collection