79
Java ListIterator hasPrevious() Method
The hasPrevious() method of ListIterator interface is used to retrieve and remove the head of the deque. The method may differ by poll() method only in one case that it throws an exception if the given deque is empty.
Syntax
Parameters
NA
Return
The above method is used to return true if the given list iterator contains more number of elements during traversing the list in the reverse direction.
Example 1
Output:
In actual order : 22 44 88 11 33 In reverse order : 33 11 88 44 22
Example 2
Output:
In actual order : N I T I N In reverse order : N I T I N
Example 3
Output:
The given string in actual order : Java is a platform independent language The given string in reverse order : language independent platform a is Java
Next TopicJava ListIterator