Javatpoint Logo
Javatpoint Logo

Java Deque poll() Method

The poll() method of Java Deque Interface is used to retrieve and remove the head of the deque. On the other hand, if the deque is empty, the method may return null. The above method is equivalent to pollFirst().

Specified by:

poll in interface Queue<E>

Syntax:

Parameter:

NA

Return:

The above method is used to return the first element of the given deque. Otherwise, the method may return a null value if the deque is empty.

Example 1

Test it Now

Output:

The first element is : 45.6
The final deque is given as : [23.0, 45.8, 66.9]

Example 2

Test it Now

Output:

The first string value is : Java
The final deque is given as : 
is
a
portable
language

Example 3

Test it Now

Output:

The first string value is : 34
The final deque is given as : 
65
59
95
68
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