Class MultiResettableIterator<E>

  • Type Parameters:
    E - type of the class of the iterator.
    All Implemented Interfaces:
    Iterator<E>, ResettableIterator<E>

    public class MultiResettableIterator<E>
    extends Object
    implements ResettableIterator<E>
    Extends MultiIterator, adding the ability if the underlying iterators are resettable, then its self can reset. It achieves this by going back to the first iterator, and as moves to another iterator it resets it.
    • Constructor Detail

      • MultiResettableIterator

        public MultiResettableIterator​(ResettableIterator<E>[] iterators)
    • Method Detail

      • moveTo

        protected void moveTo​(int index)
      • reset

        public void reset()
        Description copied from interface: ResettableIterator
        Resets the iterator so that you can iterate over all elements from your current position. Your current position (when reached again) signals the end of iteration as if the collection is circular.
        Specified by:
        reset in interface ResettableIterator<E>
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface Iterator<E>
      • next

        public E next()
        Specified by:
        next in interface Iterator<E>
      • get

        protected I get​(int index)