Class AbstractLinkedList.LinkedListIterator<E>

    • Constructor Detail

      • LinkedListIterator

        protected LinkedListIterator​(AbstractLinkedList<E> parent,
                                     int fromIndex)
                              throws java.lang.IndexOutOfBoundsException
        Create a ListIterator for a list.
        Parameters:
        parent - the parent list
        fromIndex - the index to start at
        Throws:
        java.lang.IndexOutOfBoundsException - if fromIndex is less than 0 or greater than the size of the list
    • Method Detail

      • checkModCount

        protected void checkModCount()
        Checks the modification count of the list is the value that this object expects.
        Throws:
        java.util.ConcurrentModificationException - If the list's modification count isn't the value that was expected.
      • getLastNodeReturned

        protected AbstractLinkedList.Node<E> getLastNodeReturned()
                                                          throws java.lang.IllegalStateException
        Gets the last node returned.
        Returns:
        the last node returned
        Throws:
        java.lang.IllegalStateException - If next() or previous() haven't been called, or if the node has been removed with remove() or a new node added with add(Object).
      • hasNext

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

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

        public boolean hasPrevious()
        Description copied from interface: OrderedIterator
        Checks to see if there is a previous element that can be iterated to.
        Specified by:
        hasPrevious in interface java.util.ListIterator<E>
        Specified by:
        hasPrevious in interface OrderedIterator<E>
        Returns:
        true if the iterator has a previous element
      • previous

        public E previous()
        Description copied from interface: OrderedIterator
        Gets the previous element from the container.
        Specified by:
        previous in interface java.util.ListIterator<E>
        Specified by:
        previous in interface OrderedIterator<E>
        Returns:
        the previous element in the iteration
      • 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>
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<E>
        Specified by:
        remove in interface java.util.ListIterator<E>
      • set

        public void set​(E obj)
        Specified by:
        set in interface java.util.ListIterator<E>
      • add

        public void add​(E obj)
        Specified by:
        add in interface java.util.ListIterator<E>