JavaTuples equal() method Last Updated : 09 Nov, 2022 Comments Improve Suggest changes Like Article Like Report 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: TupleClassObject- represents the JavaTuple Class object used like Unit, Quintet, Decade, etc.TupleClass2Object- represents the parameter passed JavaTuple Class object used like Unit, Quintet, Decade, etc. 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: Java // Below is a Java program to use equals() method import java.util.*; import org.javatuples.Unit; class GfG { public static void main(String[] args) { // Creating an Unit with one value Unit<String> unit = Unit.with("GeeksforGeeks"); // Creating another Unit with one value Unit<String> unit1 = Unit.with("GeeksNotforGeeks"); // Using equals() method boolean res = unit.equals(unit1); System.out.println("Is " + unit + " equal to " + unit1 + " : " + res); } } Output: Is [GeeksforGeeks] equal to [GeeksNotforGeeks] : false Program 2: Using equals() with Quartet class: Java // Below is a Java program to use equals() method import java.util.*; import org.javatuples.Quartet; class GfG { public static void main(String[] args) { // Creating Quartet from List List<String> list = new ArrayList<String>(); list.add("GeeksforGeeks"); list.add("A computer portal"); list.add("for geeks"); list.add("by Sandeep Jain"); Quartet<String, String, String, String> quartet = Quartet.fromCollection(list); // Creating Quartet from Array String[] arr = { "GeeksforGeeks", "A computer portal", "for geeks", "by Sandeep Jain" }; Quartet<String, String, String, String> otherQuartet = Quartet.fromArray(arr); // Using equals() method boolean res = quartet.equals(otherQuartet); System.out.println("Is \n" + quartet + "\n equal to \n" + otherQuartet + "\n : " + res); } } 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. Comment More infoAdvertise with us Next Article JavaTuples equal() method R RishabhPrabhu Follow Improve Article Tags : Java Java-Functions JavaTuples Practice Tags : Java Similar Reads Java Map equals() Method The equals() method of Map interface in Java is used to check if two maps are equal. Two maps are considered equal if they meet the following conditions. Both maps must have the same size.Both maps must contain identical key-value pairs. (It means every key in one map must be associated with the sam 2 min read JavaTuples compareTo() method The compareTo() method in org.javatuples is used to compare the order of a Tuple object with the object passed as the parameter. This method can be used for any tuple class object of javatuples library. It returns the difference in the ASCII value of the 1st different element present in the passed o 3 min read Set equals() Method in Java In Java, the equals() method of the Set class is used to compare two sets for equality. It checks if two sets contain the same elements regardless of their order.Example 1: This example demonstrates how to compare two HashSet collections for equality of type string using the equals() method.Java// J 2 min read LongBuffer equals() method in Java The equals() method of java.nio.LongBuffer Class is used to check whether or not the given buffer is equal to another object. Two Long buffers are equal if, and only if, They have the same element type, They have the same number of remaining elements, and The two sequences of remaining elements, con 4 min read MathContext equals() Method in Java The equals() method in the Java MathContext class is a part of the java.math package. This method is used to compare one MathContext object with another and checks whether both objects have the same precision and rounding mode settings.This method is very useful when we want to verify if two MathCon 2 min read Vector equals() Method in Java The java.util.vector.equals(Object obj) method of Vector class in Java is used verify the equality of an Object with a vector and compare them. The list returns true only if both Vector contains same elements with same order. Syntax: first_vector.equals(second_vector) Parameters: This method accepts 2 min read Java AbstractSet equals() Method The AbstractSet equals() Method in Java is used to check for equality between two sets. This method verifies whether the elements of one set are equal to the elements of another set.Syntax of AbstractSet equals() Methodpublic boolean equals(Object o)Parameter: The object "o" is to be compared for eq 1 min read Method Class | equals() Method in Java The java.lang.reflect.Method.equals(Object obj) method of Method class compares this Method Object against the specified object as parameter to equal(object obj) method. This method returns true if the Method object is the same as the passed object. Two Methods are the same if they were declared by 3 min read YearMonth equals() method in Java The equals() method of YearMonth class in Java is used to compare two YearMonth objects. It compares this YearMonth object to the YearMonth object passed to it as parameter and checks if two YearMonth instances are equal or not. Syntax: public boolean equals(Object otherYearMonth) Parameter: This me 2 min read IntBuffer equals() method in Java The equals() method of java.nio.IntBuffer Class is used to check whether or not the given buffer is equal to another object. Two int buffers are equal if, and only if, They have the same element type, They have the same number of remaining elements, and The two sequences of remaining elements, consi 4 min read Like