Java LinkedBlockingDeque peekLast() MethodThe peekLast() method of LinkedBlockingDeque class retrieves this deque's last element, but doesn't remove it. The method returns null if this deque is empty. Syntax:Parameters:NA Specified By:The peekLast () method of LinkedBlockingDeque class is specified by peekLast() method in interface Deque<E>. Return Value:The peekLast () method returns this deque's tail, and returns null if this deque is empty. Example 1Test it NowOutput: Last element of deque : 943 Deque after peekLast() : [412, 556, 654, 732, 879, 943] Example 2Test it NowOutput: Last element of deque1 : Nitin Deque1 after peekLast() : [Keshav, Naveen, Neha, Hitesh, Surbhi, Nitin] Last element of deque2 : Riya Deque2 after peekLast() : [Ankit, Megha, Janak, Riya] Example 3Test it NowOutput: Last element of deque : null Deque after peekLast() : [] Next TopicJava Linkedblockingdeque |
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