The ConcurrentLinkedDeque.removeFirst() is an in-built function in Java which removes the first element from the deque container. The function throws a
NoSuchElementException if
this deque is empty.
Syntax:
Conn_Linked_Deque.removeFirst()
Parameters: The function does not accepts any parameter.
Return Values: The function returns the first element in the deque.
Exception: The function throws a
NoSuchElementException if
this deque is empty.
Below program illustrates the removeFirst() method:
Program 1: This program involves deque with
Integer elements.
Output:
Elements inthe LinkedDeque: [475, 1009, 70, 12]
Element removed : 475
Elements inthe LinkedDeque: [1009, 70, 12]
Program 2: This program involves deque with
String elements.