VOOZH about

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

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


  • Courses
  • Tutorials
  • Interview Prep

ConcurrentLinkedDeque pop() method in Java with Examples

Last Updated : 16 Dec, 2021

The Java.util.ConcurrentLinkedDeque.pop() method in Java is used to pop an element from the ConcurrentLinkedDeque. The element is popped from the top of the ConcurrentLinkedDeque and is removed from the same.
Syntax: 
 

ConcurrentLinkedDeque.pop()


Parameters: The method does not take any parameters.
Return Value: This method returns the element present at the top of the ConcurrentLinkedDeque and then removes it.
Exceptions: The method throws EmptyConcurrentLinkedDequeException is thrown if the ConcurrentLinkedDeque is empty.
Below programs illustrate the Java.util.ConcurrentLinkedDeque.pop() method:
Program 1:
 

Output:

Initial ConcurrentLinkedDeque: [Geeks, For, Geeks, To, Welcome]
Popped element: Geeks
Popped element: For
ConcurrentLinkedDeque after pop operation [Geeks, To, Welcome]

Program 2:
 


Output: 
Initial ConcurrentLinkedDeque: [5, 20, 30, 15, 10]
Popped element: 5
Popped element: 20
ConcurrentLinkedDeque after pop operation [30, 15, 10]

 
Comment