The java.util.concurrent.ConcurrentLinkedDeque.getFirst() method is an in-built method in Java which returns the first element of the deque container.
Parameters: The method does not accept any parameter.
Return Value: The method returns the first element present in the Deque.
Exception: The function throws a NoSuchElementException when the deque is empty.
Below programs illustrate the ConcurrentLinkedDeque.getFirst() method :
Elements in the Deque: [Welcome, To, Geeks, 4, Geeks] The first element is: Welcome
java.util.NoSuchElementException Elements in the Deque: [12, 43, 29, 16, 70] The first element is: 12
- LinkedList getFirst() Method in Java
- ArrayDeque getFirst() Method in Java
- LinkedBlockingDeque getFirst() method in Java
- Deque getFirst() method in Java
- ConcurrentLinkedDeque add() method in Java
- ConcurrentLinkedDeque offerFirst() method in Java
- ConcurrentLinkedDeque pop() method in Java with Examples
- ConcurrentLinkedDeque iterator() method in Java with Example
- ConcurrentLinkedDeque element() method in Java
- ConcurrentLinkedDeque removeFirstOccurrence() method in Java
- ConcurrentLinkedDeque toArray() method in Java with Example
- ConcurrentLinkedDeque descendingIterator() method in Java with Example
- ConcurrentLinkedDeque offerLast() Method in Java
- ConcurrentLinkedDeque poll() method in Java with Example
- ConcurrentLinkedDeque removeFirst() method in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.