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