Collection equals()
Java Collection equals() Method
Last Updated : 17 Mar 2025
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:
Example 2
Output:
Equals methods will return : false