Java ListIterator nextIndex() MethodThe 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 1Test it NowOutput: 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 2Test it NowOutput: 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 3Test it NowOutput: 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 provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India