The java.util.concurrent.ConcurrentLinkedDeque.offerLast() method is an inbuilt method in Java which inserts the specified element, passed as a parameter, to the end of the deque.
Syntax:
Conn_Linked_Deque.offerLast(Object elem)
Parameters: The method accepts a parameter
elem which species the element to be inserted to the end of the deque.
Return Value: The function returns
True if the element is successfully added into the deque and returns
False otherwise.
Exception: The function throws a
NullPointerException if the passed parameter is
NULL.
Below programs illustrate the
ConcurrentLinkedDeque.offerLast() method:
Program 1:
Output:
Elements in Deque: [Welcome, To, Geeks, 4, Geeks]
The Last element is: Geeks
The Inserted element is: GFG
Elements in Deque: [Welcome, To, Geeks, 4, Geeks, GFG]
The Last element is: GFG
Program 2: