ConcurrentLinkedDeque element() method in Java Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The java.util.concurrent.ConcurrentLinkedDeque.element() is an in-built function in java which retrieves but does not remove the head of the queue represented by deque i.e the first element of deque.Syntax: conn_linked_deque.element() Parameter: This method has no parameters.Return Value: This method returns the first element in the deque.Exception: This method will throw NoSuchElementException if the deque is empty.Below programs illustrate the ConcurrentLinkedDeque.element() method:Program 1: This program involves a ConcurrentLinkedDeque of Integer type. JAVA // Java example illustrating // ConcurrentLinkedDeque element() method import java.util.concurrent.*; class ConcurrentLinkedDequeDemo { public static void main(String[] args) { // Create a ConcurrentLinkedDeque // using ConcurrentLinkedDeque() constructor ConcurrentLinkedDeque<Integer> cld = new ConcurrentLinkedDeque<Integer>(); cld.add(12); cld.add(70); cld.add(1009); cld.add(475); // Displaying the existing LinkedDeque System.out.println("ConcurrentLinkedDeque: " + cld); // Displaying the head of deque System.out.println("The Head of deque is: " + cld.element()); } } Output: ConcurrentLinkedDeque: [12, 70, 1009, 475] The Head of deque is: 12 Program 2: This program involves a ConcurrentLinkedDeque of String type. JAVA // Java example illustrating // ConcurrentLinkedDeque element() method import java.util.concurrent.*; class ConcurrentLinkedDequeDemo { public static void main(String[] args) { // Create a ConcurrentLinkedDeque // using ConcurrentLinkedDeque() constructor ConcurrentLinkedDeque<String> cld = new ConcurrentLinkedDeque<String>(); cld.add("Gfg"); cld.add("Geeks"); cld.add("Programming"); cld.add("contribute"); // Displaying the existing LinkedDeque System.out.println("ConcurrentLinkedDeque: " + cld); // Displaying the head of deque System.out.println("The Head of deque is: " + cld.element()); } } Output: ConcurrentLinkedDeque: [Gfg, Geeks, Programming, contribute] The Head of deque is: Gfg Comment More infoAdvertise with us Next Article ConcurrentLinkedDeque equals() method in Java with Example K kanakasrijaathukuri Follow Improve Article Tags : Java Practice Tags : Java Similar Reads ConcurrentLinkedDeque getLast() Method in Java The java.util.concurrent.ConcurrentLinkedDeque.getLast() method is an in-built method in Java which returns the last element of the deque container. Syntax: Conn_Linked_Deque.getLast() Parameters: The method does not accept any parameter. Return Value: The method returns the last element present in 2 min read ConcurrentLinkedDeque getFirst() method in Java The java.util.concurrent.ConcurrentLinkedDeque.getFirst() method is an in-built method in Java which returns the first element of the deque container. Syntax: Conn_Linked_Deque.getFirst() Parameters: The method does not accept any parameter. Return Value: The method returns the first element present 2 min read ConcurrentLinkedDeque add() method in Java The java.util.concurrent.ConcurrentLinkedDeque.add() is an in-built function in Java which inserts the specified element at the end of the deque. Syntax: conn_linked_deque.add(elem) Parameter: The method accepts only a single parameter elem which is to be added to tail of the ConcurentLinkedDeque. R 2 min read ConcurrentLinkedDeque size() method in Java The size() method of ConcurrentLinkedDeque class in Java is used to find the number of elements present in the ConcurrentLinkedDeque container. In other words, this method tells the current capacity of the container. The value returned by this method is of integral type and in case if the container 2 min read ConcurrentLinkedDeque equals() method in Java with Example 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 p 2 min read ConcurrentLinkedQueue add() method in Java The add() method of ConcurrentLinkedQueue is used to insert the element, passed as parameter to add() of ConcurrentLinkedQueue, at the tail of this ConcurrentLinkedQueue. This method returns True if insertion is successful. ConcurrentLinkedQueue is unbounded, so this method will never throw IllegalS 2 min read Like