Java Deque poll() MethodThe 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 1Test it NowOutput: The first element is : 45.6 The final deque is given as : [23.0, 45.8, 66.9] Example 2Test it NowOutput: The first string value is : Java The final deque is given as : is a portable language Example 3Test it NowOutput: The first string value is : 34 The final deque is given as : 65 59 95 68 Next TopicJava Deque |
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