Peek() Method : Java.util.ArrayDeque

   

Declaration :

Explanation :

Purpose The java.util.ArrayDeque.peek() method retrieves the head of the queue(but does not remove) represented by this deque.Returns null if this deque is empty.
Parameters NA
Return Value This method returns the head of the queue represented by this deque or null if this deque is empty.
Exception NA

Java Program : Example

Below example will explain java.util.ArrayDeque.peek() method.

Output of Program :