Class MultiResettableIterator<E>

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

    public class MultiResettableIterator<E>
    extends java.lang.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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected I get​(int index)  
      boolean hasNext()  
      protected void moveTo​(int index)  
      E next()  
      void reset()
      Resets the iterator so that you can iterate over all elements from your current position.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, hasNext, next, remove
    • 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 java.util.Iterator<E>
      • next

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

        protected I get​(int index)