I need to traverse a LinkedList a number of times, in a way that suggests using ListIterator.
Is there a way to reset a ListIterator? or is it better to just create a new one? (and what if I can't because I don't have access to the list?)
edit: and is there a way to create a ListIterator that points to the end of the list? (so that hasNext() is false but I can use previous() or hasPrevious())
Create a new
LinkedListbased on the obtainedListIterator, so that you can get as many iterators from it as you want.Edit: as to your second question which you edited in afterwards, consider doing a
Collections#reverse()on the list first.