Javatpoint Logo
Javatpoint Logo

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

Test it Now

Output:

true

Example 2

Test it Now

Output:

Equals methods will return : false
Next TopicJava Collection





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA