Java Deque peekFirst() MethodThe peekFirst() method of Java Deque Interface retrieves and not remove the first element of the given deque. But, if the deque is empty, it may return null. Syntax:Parameter:N.A. Return:The above method is used to return the head of the given deque. On the other hand, if the deque is empty, the method may return null. Example 1Test it NowOutput: The first value is given as : Tina The deque is given as : [Tina, Shyam, Isha, Falguni] Example 2Test it NowOutput: The first integer value is given as : 34 The deque is given as : [34, 43, 22, 55] Example 3Test it NowOutput: The first characater value is given as : H The final deque is given as : H E L L O 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