Java Deque removeFirst() MethodThe removeFirst() method of Deque interface is used to retrieve and removes the first element of the given deque. The above method is different from the pollFirst() method such that it throws an exception if the given deque is empty. Syntax:Parameter:NA Return:The above method is used to return the head of the given deque. Throw:NoSuchElementException- If the given deque is empty. Example 1Test it NowOutput: The removed string is : Welcome The resultant deque is : to our site Example 2Test it NowOutput: The removed integer value is : 66 The resultant deque is : 11 33 44 Example 3Test it NowOutput: The removed long value is : 11 The resultant deque is : 88 22 99 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