Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedBlockingDeque; public class LinkedBlockingDequeAddFirstExample1 { public static void main(String[] args) { int capacity=100; LinkedBlockingDeque
deque = new LinkedBlockingDeque
(capacity); for (int i = 1; i <=5; i++) { // Adding items to the tail of this queue deque.add(i); } System.out.println(deque); System.out.println("After inserting 10 at first position"); deque.addFirst(10); System.out.println(deque); } }
Output