Class ArrayIterator<E>

  • All Implemented Interfaces:
    java.util.Iterator<E>

    public final class ArrayIterator<E>
    extends java.lang.Object
    implements java.util.Iterator<E>
    Generic ArrayIterator.
    Author:
    thomas.jungblut
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayIterator​(E[] array)
      Get a new ArrayIterator for the given array.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIndex()  
      boolean hasNext()
      Checks if the iterator has something to iterate by checking the current iteration index against the array length.
      E next()  
      void remove()
      Removes the current item from the list.
      • 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
    • Constructor Detail

      • ArrayIterator

        public ArrayIterator​(E[] array)
        Get a new ArrayIterator for the given array.
    • Method Detail

      • hasNext

        public final boolean hasNext()
        Checks if the iterator has something to iterate by checking the current iteration index against the array length.
        Specified by:
        hasNext in interface java.util.Iterator<E>
        Returns:
        true if there is a next item or false if not.
      • next

        public final E next()
        Specified by:
        next in interface java.util.Iterator<E>
        Returns:
        the next entry in the array.
      • getIndex

        public final int getIndex()
        Returns:
        the current index of the last "nexted" item.
      • remove

        public final void remove()
        Removes the current item from the list.
        Specified by:
        remove in interface java.util.Iterator<E>