Class ListIteratorWrapper<E>

  • 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