Class ObjectListIterator<E>

  • Type Parameters:
    E - The type of elements in this iterator
    All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Iterator<E>, java.util.ListIterator<E>

    public class ObjectListIterator<E>
    extends ObjectIterator<E>
    implements java.util.ListIterator<E>
    An iterable and iterator to a single object. This implementation allows null values. This implementation does not allow removal, as removing has no meaning in this context.
    Author:
    Garret Wilson
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean hasNext
      Whether we've not retrieved the object.
    • Constructor Summary

      Constructors 
      Constructor Description
      ObjectListIterator​(E object)
      Object constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(E e)
      This implementation does not support adding an element.
      boolean hasNext()
      boolean hasPrevious()
      E next()
      int nextIndex()
      E previous()
      int previousIndex()
      void set​(E e)
      This implementation does not support setting the element.
      • Methods inherited from class java.lang.Object

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

        forEach, spliterator
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
      • Methods inherited from interface java.util.ListIterator

        remove
    • Field Detail

      • hasNext

        protected boolean hasNext
        Whether we've not retrieved the object.
    • Constructor Detail

      • ObjectListIterator

        public ObjectListIterator​(E object)
        Object constructor.
        Parameters:
        object - The single object over which iteration should occur.
    • Method Detail

      • hasNext

        public boolean hasNext()
        Description copied from class: ObjectIterator
        Specified by:
        hasNext in interface java.util.Iterator<E>
        Specified by:
        hasNext in interface java.util.ListIterator<E>
        Overrides:
        hasNext in class ObjectIterator<E>
        Returns:
        true if the single object has not yet been retrieved.
      • next

        public E next()
        Specified by:
        next in interface java.util.Iterator<E>
        Specified by:
        next in interface java.util.ListIterator<E>
        Overrides:
        next in class ObjectIterator<E>
      • hasPrevious

        public boolean hasPrevious()
        Specified by:
        hasPrevious in interface java.util.ListIterator<E>
      • previous

        public E previous()
        Specified by:
        previous in interface java.util.ListIterator<E>
      • nextIndex

        public int nextIndex()
        Specified by:
        nextIndex in interface java.util.ListIterator<E>
      • previousIndex

        public int previousIndex()
        Specified by:
        previousIndex in interface java.util.ListIterator<E>
      • set

        public void set​(E e)
        This implementation does not support setting the element.
        Specified by:
        set in interface java.util.ListIterator<E>
      • add

        public void add​(E e)
        This implementation does not support adding an element.
        Specified by:
        add in interface java.util.ListIterator<E>