I need to know how to "reset" LinkedList iterator to its first element.
For example:
LinkedList<String> list;
Iterator iter=list.listIterator;
iter.next();
iter.next();
Over and over again and after many moves of the iterator I need to "reset" the position of iterator. `
I want to ask how I can "reset" my iterator to first element
I know that I can get list iterator of the first element in this way:
iter= list.listIterator(1);
Is this the best solution? or maybe I missed something in Oracle docs?
question from:https://stackoverflow.com/questions/13689288/java-reset-list-iterator-to-first-element-of-the-list