Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; public class LinkedBlockingDequePollLastExample3 { public static void main(String[] args) throws InterruptedException { int capacity = 5; LinkedBlockingDeque
deque = new LinkedBlockingDeque
(capacity); deque.add(67); deque.add(109); deque.add(76); deque.add(876); //retrieves and removes the last element of the deque waiting upto the specified wait time int val=deque.pollLast(678, TimeUnit.MILLISECONDS); System.out.println("Last element of the deque : "+val); System.out.println("Elements in deque : "+deque); } }
Output