Class ListIteratorWrapper<E>

java.lang.Object
org.apache.commons.collections4.iterators.ListIteratorWrapper<E>
Type Parameters:
E - the type of elements in this iterator.
All Implemented Interfaces:
Iterator<E>, ListIterator<E>, OrderedIterator<E>, ResettableIterator<E>, ResettableListIterator<E>

public class ListIteratorWrapper<E> extends Object implements ResettableListIterator<E>
Converts an Iterator into a ResettableListIterator. For plain Iterators this is accomplished by caching the returned elements. This class can also be used to simply add ResettableIterator functionality to a given ListIterator.

The ListIterator interface has additional useful methods for navigation - previous() and the index methods. This class allows a regular Iterator to behave as a ListIterator. It achieves this by building a list internally of as the underlying iterator is traversed.

The optional operations of ListIterator are not supported for plain Iterators.

This class implements ResettableListIterator from Commons Collections 3.2.

Since:
2.1