Javatpoint Logo
Javatpoint Logo

Java Deque pollFirst() Method

The pollFirst() method of Java Deque Interface is used to retrieve and remove the first element of the deque. The method may return null if the given deque is empty.

Syntax:

Parameter:

NA

Return:

The above method is used to return the head of the deque. On the other hand, if the deque is empty, the method may return null.

Example 1

Test it Now

Output:

The first character is given as : q
The remaining deque is : 
u
e
r
y

Example 2

Test it Now

Output:

The first string is given as : Hello
The remaining deque is : [ , World]

Example 3

Test it Now

Output:

The first long value is given as : 88
The resultant deque is : [88, 78, 67]
Next TopicJava Deque





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA