Java ArrayList listIterator() methodThe listIterator () method of Java ArrayList returns a list iterator over the elements in this list starting at the specified position in this list. The specified index indicates the first element that would be returned by an initial call to next. An initial call to previous would return the element with the specified index minus one. Syntax:Parameter:"index": is the index of the first element to be returned from the list iterator when calling iterator.next () method. Return:Return "ListIterator": returns list iterator over the elements in this list starting at the specified position in this list. Exception:IndexOutOfBoundsException:If the index is out of range (index<0 || index > size). Example 1Test it NowOutput: [d, dd, ddd, dddd, ddddd] ddd dddd ddddd Example 2Test it NowOutput: [d, dd, ddd, dddd, ddddd] false IndexOutOfBoundsException Next TopicJava ArrayList |
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