Java ListIterator previousIndex() MethodThe previousIndex() method of ListIterator interface is used to return the index of the given element which is returned by a call to previous. The method may return -1 if and only if the iterator is placed at the beginning of the list. SyntaxParametersNA ReturnThe above method is used to return the index of the given element which is returned by a call to previous. The method may return -1 if and only if the iterator is placed at the beginning of the list. Example 1Test it NowOutput: The letters are listed as : [R, E, A, L] The Previous Index is : -1 The Previous Index is : 0 The Next Index is : 1 The Next index is : 2 Example 2Test it NowOutput: The numbers are listed as : [34, 78, 57] The Previous Index is : -1 The Previous Index is : 0 The Next Index is : 1 Next TopicJava ListIterator |
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