Class AbstractLinkedList.LinkedListIterator

    • Constructor Detail

      • LinkedListIterator

        protected LinkedListIterator​(AbstractLinkedList 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
    • 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 getLastNodeReturned()
                                                       throws java.lang.IllegalStateException
        Gets 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
        Specified by:
        hasNext in interface java.util.ListIterator
      • next

        public java.lang.Object next()
        Specified by:
        next in interface java.util.Iterator
        Specified by:
        next in interface java.util.ListIterator
      • 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
        Specified by:
        hasPrevious in interface OrderedIterator
        Returns:
        true if the iterator has a previous element
      • previous

        public java.lang.Object previous()
        Description copied from interface: OrderedIterator
        Gets the previous element from the collection.
        Specified by:
        previous in interface java.util.ListIterator
        Specified by:
        previous in interface OrderedIterator
        Returns:
        the previous element in the iteration
      • nextIndex

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

        public int previousIndex()
        Specified by:
        previousIndex in interface java.util.ListIterator
      • remove

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

        public void set​(java.lang.Object obj)
        Specified by:
        set in interface java.util.ListIterator
      • add

        public void add​(java.lang.Object obj)
        Specified by:
        add in interface java.util.ListIterator