ConcurrentLinkedDeque pop() method in Java with Examples Last Updated : 16 Dec, 2021 Comments Improve Suggest changes Like Article Like Report 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: Java // Java code to illustrate pop() import java.util.*; import java.util.concurrent.*; public class ConcurrentLinkedDequeDemo { public static void main(String args[]) { // Creating an empty ConcurrentLinkedDeque ConcurrentLinkedDeque<String> CLD = new ConcurrentLinkedDeque<String>(); // Use add() method to add elements CLD.push("Welcome"); CLD.push("To"); CLD.push("Geeks"); CLD.push("For"); CLD.push("Geeks"); // Displaying the ConcurrentLinkedDeque System.out.println("Initial ConcurrentLinkedDeque: " + CLD); // Removing elements using pop() method System.out.println("Popped element: " + CLD.pop()); System.out.println("Popped element: " + CLD.pop()); // Displaying the ConcurrentLinkedDeque after pop operation System.out.println("ConcurrentLinkedDeque after pop operation " + CLD); } } Output: Initial ConcurrentLinkedDeque: [Geeks, For, Geeks, To, Welcome] Popped element: Geeks Popped element: For ConcurrentLinkedDeque after pop operation [Geeks, To, Welcome] Program 2: Java // Java code to illustrate pop() import java.util.*; import java.util.concurrent.*; public class ConcurrentLinkedDequeDemo { public static void main(String args[]) { // Creating an empty ConcurrentLinkedDeque ConcurrentLinkedDeque<Integer> CLD = new ConcurrentLinkedDeque<Integer>(); // Use add() method to add elements CLD.push(10); CLD.push(15); CLD.push(30); CLD.push(20); CLD.push(5); // Displaying the ConcurrentLinkedDeque System.out.println("Initial ConcurrentLinkedDeque: " + CLD); // Removing elements using pop() method System.out.println("Popped element: " + CLD.pop()); System.out.println("Popped element: " + CLD.pop()); // Displaying the ConcurrentLinkedDeque after pop operation System.out.println("ConcurrentLinkedDeque after pop operation " + CLD); } } Output: Initial ConcurrentLinkedDeque: [5, 20, 30, 15, 10] Popped element: 5 Popped element: 20 ConcurrentLinkedDeque after pop operation [30, 15, 10] Comment More infoAdvertise with us Next Article ConcurrentLinkedDeque pop() method in Java with Examples M MerlynShelley Follow Improve Article Tags : Java Technical Scripter Technical Scripter 2018 Java-Collections Java - util package Java-Functions Java-ConcurrentLinkedDeque +3 More Practice Tags : JavaJava-Collections Similar Reads ConcurrentLinkedDeque poll() method in Java with Example The poll() method of ConcurrentLinkedDeque returns the front element in the Deque container and deletes it. It returns null if the container is empty. Syntax: public E poll() Parameters: This method does not accept any parameters. Returns: This method returns front element of the Deque container if 2 min read ConcurrentLinkedDeque push() method in Java with Examples The push() method of ConcurrentLinkedDeque class is an in-built function in Java which pushes an element onto the stack represented by this deque (in other words, at the head of this deque) if it is possible to do so immediately without violating capacity restrictions, returning true upon success an 2 min read ConcurrentLinkedDeque offer() method in Java with Examples 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 de 2 min read ConcurrentLinkedDeque peek() method in Java with Example The java.util.ConcurrentLinkedDeque.peek() method in Java is used to retrieve or fetch the element at the head of the Deque. The element retrieved does not get deleted or removed from the Deque instead the method just returns it. If no element is present in the deque then Null is returned. Syntax: A 2 min read ConcurrentLinkedDeque iterator() method in Java with Example The Java.util.concurrent.ConcurrentLinkedDeque.iterator() method is used to return an iterator of the same elements as that of the ConcurrentLinkedDeque. The elements are returned in random order from what was present in the deque. Syntax: Iterator iterate_value = ConcurrentLinkedDeque.iterator(); P 2 min read ConcurrentLinkedDeque pollFirst() method in Java The java.util.concurrent.ConcurrentLinkedDeque.pollFirst() is an in-built method in Java which retrieves the first element of this deque and removes it. If the deque is empty, the method returns NULL. Syntax: Conn_Linked_Deque.pollFirst() Parameters: This function does not accepts any parameter. Ret 2 min read ConcurrentLinkedDeque pollLast() method in Java The java.util.concurrent.ConcurrentLinkedDeque.pollLast() is an in-built method in Java which retrieves the last element of this deque and removes it. If the deque is empty, the method returns NULL. Syntax: Conn_Linked_Deque.pollLast() Parameters: The function accepts no parameters. Return Values:Th 2 min read BlockingDeque poll() method in Java with examples The poll() method of BlockingDeque returns the front element in the Deque container and deletes it. It returns null if the container is empty. Syntax: public E poll() Parameters: This method does not accept any parameters. Returns: This method returns front element of the Deque container if the cont 2 min read ConcurrentLinkedQueue poll() method in Java The poll() method of ConcurrentLinkedQueue is used to remove and return the head of this ConcurrentLinkedQueue. If the ConcurrentLinkedQueue is empty then this method will return null. Syntax: public E poll() Returns: This method remove and returns the head of this ConcurrentLinkedQueue or null if t 2 min read Like