Java Deque getFirst() MethodThe getFirst() method of Java Deque Interface retrieves but does not remove the first element of the given deque. The above method differs from peekFirst only in one way that it throws an exception if the deque is empty. Syntax:Parameter:NA Return:The above method returns the head of the deque. Example 1Test it NowOutput: The list of the elements is given as : [44.0, 66.0, 11.0, 99.0] The final result of the deque is given as : 44.0 Example 2Test it NowOutput: The list of the elements is given as : [k, p, m, t] The final result of the deque is given as : k 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