VOOZH about

URL: https://www.geeksforgeeks.org/java/concurrentlinkeddeque-offer-method-in-java-with-examples/

⇱ ConcurrentLinkedDeque offer() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ConcurrentLinkedDeque offer() method in Java with Examples

Last Updated : 11 Jul, 2025
The java.util.concurrent.ConcurrentLinkedDeque.offer() method is an inbuilt method in Java which inserts the specified element, passed as a parameter, to the deque. Syntax:
public boolean offer(E elem)
Parameters: The method accepts a parameter elem which species the element to be inserted to 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.offer() method: Program 1:
Output:
ConcurrentLinkedDeque: [Welcome, To, Geeks, 4, Geeks]
Element Inserted
ConcurrentLinkedDeque: [Welcome, To, Geeks, 4, Geeks, GFG]
Output:
ConcurrentLinkedDeque: [Welcome, To, Geeks, 4, Geeks]
java.lang.NullPointerException
Reference: https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/ConcurrentLinkedDeque.html#offer-E-
Comment
Article Tags:
Article Tags: