Java ListIterator nextIndex() Method22 Mar 2025 | 2 min read The nextIndex() method of ListIterator interface is used to return the index of the element which is returned by the next() method. SyntaxParametersNA ReturnThe above method is used to return the index of the element which is returned by the next() method. The method may also return the list size only if the list iterator is placed at the end of the list. Example 1Output: The vehicles are listed as :[Scooter, Car, Truck, Bike] The first Index is given as : 0 The second Index is given as : 1 The third index is given as : 2 The fourth index is given as : 3 Example 2Output: The marks are listed as : [22.4, 34.98, 12.9, 76.4] The first Index is given as : 0 The second Index is given as : 1 The third index is given as : 2 The fourth index is given as : 3 Example 3Output: The ages are listed as :[5, 10, 15, 20] The first Index is given as : 0 The second Index is given as : 1 The third index is given as : 2 The fourth index is given as : 3 Next TopicJava ListIterator |
We request you to subscribe our newsletter for upcoming updates.

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