ConcurrentLinkedDeque equals() method in Java with Example Last Updated : 27 Dec, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The equals() method of java.util.ConcurrentLinkedDeque class is used to compare the specified object with this ConcurrentLinkedDeque for equality. Returns true if and only if the specified object is also a ConcurrentLinkedDeque, both ConcurrentLinkedDeques have the same size, and all corresponding pairs of elements in the two ConcurrentLinkedDeques are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two ConcurrentLinkedDeques are defined to be equal if they contain the same elements in the same order. Syntax: public boolean equals(Object o) Parameters: This method takes the object o as a parameter to be compared for equality with this ConcurrentLinkedDeque. Return Value: This method returns true if the specified object is equal to this ConcurrentLinkedDeque. Below programs illustrate the ConcurrentLinkedDeque.equals() method: Program 1: Java // Java Program Demonstrate equals() // method of ConcurrentLinkedDeque import java.util.concurrent.ConcurrentLinkedDeque; import java.util.*; public class GFG { public static void main(String[] args) throws IllegalStateException { // create object of ConcurrentLinkedDeque ConcurrentLinkedDeque<Integer> CLD1 = new ConcurrentLinkedDeque<Integer>(); // Add numbers to end of ConcurrentLinkedDeque CLD1.add(7855642); CLD1.add(35658786); CLD1.add(5278367); CLD1.add(74381793); System.out.println("Linked Blocking Deque 1: " + CLD1); // create another object of ConcurrentLinkedDeque ConcurrentLinkedDeque<String> CLD2 = new ConcurrentLinkedDeque<String>(); // Add numbers to end of ConcurrentLinkedDeque CLD2.add("1"); CLD2.add("2"); CLD2.add("3"); CLD2.add("4"); System.out.println("Linked Blocking Deque 2: " + CLD2); // using equals() function System.out.println("Are both Linked Blocking Deque equal: " + CLD1.equals(CLD2)); } } Output: Linked Blocking Deque 1: [7855642, 35658786, 5278367, 74381793] Linked Blocking Deque 2: [1, 2, 3, 4] Are both Linked Blocking Deque equal: false Program 2: Java // Java Program Demonstrate equals() // method of ConcurrentLinkedDeque // when the list contains characters import java.util.concurrent.ConcurrentLinkedDeque; import java.util.*; public class GFG { public static void main(String[] args) throws IllegalStateException { // create object of ConcurrentLinkedDeque ConcurrentLinkedDeque<String> CLD1 = new ConcurrentLinkedDeque<String>(); // Add numbers to end of ConcurrentLinkedDeque CLD1.add("1"); CLD1.add("2"); CLD1.add("3"); CLD1.add("4"); System.out.println("Linked Blocking Deque 1: " + CLD1); // using equals() function System.out.println("Is CLD1 equal to CLD1: " + CLD1.equals(CLD1)); } } Output: Linked Blocking Deque 1: [1, 2, 3, 4] Is CLD1 equal to CLD1: true Comment More infoAdvertise with us Next Article Double.equals() Method in Java with Examples C code_r Follow Improve Article Tags : Java Java-Collections Java-Functions Java-ConcurrentLinkedDeque Practice Tags : JavaJava-Collections Similar Reads ConcurrentLinkedDeque contains() method in Java with Examples The java.util.concurrent.ConcurrentLinkedDeque.contains() method is an inbuilt method in Java which checks if the specified element, passed as a parameter, is present in the deque or not. Syntax: public boolean contains(Object elem) Parameters: The method accepts a parameter elem which checks if the 2 min read ConcurrentSkipListMap equals() method in Java with Examples The equals() method of java.util.concurrent.ConcurrentSkipListMap is an in-built function in Java which to check the equality of this Map object with the specified object. The method returns true if the given object is also a map of the previous one and the two maps have the same mappings. Syntax: p 2 min read Double.equals() Method in Java with Examples The Double.equals() in Java is a built-in function from the java.lang.Double class. This method compares the content of two Double objects. The result is true if and only if the argument is not null and is a Double object that contains the same double value as this object. This method is useful for 3 min read Charset equals() method in Java with Examples The equals() method is a built-in method of the java.nio.charset checks if a given object of charset is equal to another given object of the charset. Two charsets are considered equal if, and only if, they have the same canonical names. A charset is never equal to any other type of object. Syntax: p 2 min read CompoundName equals() method in Java with Examples The equals() method of a javax.naming.CompoundName class is used to compare this CompoundName with the specified object passed as a parameter and checks whether two objects are equal or not. If both objects are equal then the equals() method returns true else false. If passed obj is null or not a co 2 min read ChronoPeriod equals() method in Java with Examples The equals() method of ChronoPeriod interface in Java is used to check if two given periods are equal or not. The comparison is based on the type ChronoPeriod and each of the three years, months and date. To be equal, all of the three years, month and date must be individually equal. Syntax: boolean 2 min read Like