Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedBlockingDeque; public class LinkedBlockingDequePeekExample1 { public static void main(String[] args) { int capacity =100; LinkedBlockingDeque
deque = new LinkedBlockingDeque
(capacity); deque.add("Vishakha"); deque.add("Mansi"); deque.add("Ujjwal"); deque.add("Ankit"); //peek() method will retrieve the head of the deque System.out.println("Head of deque : "+deque.peek()); //peek() will not remove the head from the deque System.out.println("Deque after peek() : "+deque); } }
Output