Java Deque peek () Method22 Mar 2025 | 2 min read The peek() method of Java Deque Interface is used to retrieve but not to remove the head of the deque. The method may return null if the given deque is empty. Specified by:
Syntax:Parameter:NA Return:The above method is used to return the head of the deque which is represented by the queue. On the other hand, if the deque is empty, the method may return null. Example 1Output: The first character is given as : T The deque is : T P O I N T T E C H Example 2Output: The first string is given as : Hello The deque is : [Hello, , World] Example 3Output: The first long value is given as : 88 The resultant deque is : [88, 78, 67] Next TopicJava Deque |
We request you to subscribe our newsletter for upcoming updates.

We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India