![]() |
VOOZH | about |
The equals() method in org.javatuples is used to check whether a TupleClass is equal to the TupleClass given as parameter. This method can be used to any tuple class object of javatuples library. It returns a boolean value that is true or false based on the equivalence of that TupleClass with existing TupleClass. Method Declaration:
public final boolean equals(Object obj)
Syntax:
boolean result = TupleClassObject.equals(TupleClass2Object)
Parameters: This method takes TupleClass2Object as parameter where:
Return Value: This method returns true if the TupleClassObject is equal to the TupleClass2Object. Else it returns false Below programs illustrate the various ways to use equals() method: Program 1: Using equals() with Unit class:
Output:
Is [GeeksforGeeks] equal to [GeeksNotforGeeks] : false
Program 2: Using equals() with Quartet class:
Output:
Is [GeeksforGeeks, A computer portal, for geeks, by Sandeep Jain] equal to [GeeksforGeeks, A computer portal, for geeks, by Sandeep Jain] : true
Note: Similarly, it can be used with any other JavaTuple Class.