100
Java Deque peekLast() Method
The peekLast() method of Java Deque Interface retrieves and not remove the last element of the given deque. But, if the deque is empty, it may return null.
Syntax:
Parameter:
NA
Return:
The above method is used to return the tail of the given deque. On the other hand, if the deque is empty, the method may return null.
Example 1
Output:
The last character is given as : A The final deque is given as : J A V A
Example 2
Output:
The last string value is given as : language The final deque is given as : [Java, is, a, secured, language]
Example 3
Output:
The last integer value is given as : 5 The final deque is given as : 1 2 3 4 5
Next TopicJava Deque