VOOZH about

URL: https://www.geeksforgeeks.org/java/concurrentlinkeddeque-element-method-in-java/

⇱ ConcurrentLinkedDeque element() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ConcurrentLinkedDeque element() method in Java

Last Updated : 11 Jul, 2025

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.
 


Output: 
ConcurrentLinkedDeque: [12, 70, 1009, 475]
The Head of deque is: 12

 

Program 2: This program involves a ConcurrentLinkedDeque of String type.
 


Output: 
ConcurrentLinkedDeque: [Gfg, Geeks, Programming, contribute]
The Head of deque is: Gfg

 
Comment
Article Tags:
Article Tags: