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 the Deque.
Exception: The function throws a
NoSuchElementException when the deque is empty.
Below programs illustrate the
ConcurrentLinkedDeque.getLast() method:
Program 1:
Output:
Elements in Deque: [Welcome, To, Geeks, 4, Geeks]
The Last element is: Geeks
Program 2: