Interface ReadOnlyListIterator<E>

  • Type Parameters:
    E - the type of elements returned by this list iterator

    public interface ReadOnlyListIterator<E>
    This interface was originally copied from GitHub's Open-JDK Account. Though the original file has been modified, few changes have been applied to the Javadoc Commenting. Due to fact that that is a Java interface file, there were few method bodies with Source-Code to begin with - meaning this is largely a copy of Method-Signatures and Java-Doc Comments.

    Method and parameter names & types have not been modified whatsoever; but several methods had to be eliminated for not being Read-Only. This Source-File was copied from the original Open JDK-21 file of the same (or, rather, highly similar) Interface-Name. The original file may be viewed on the JDK-21 GitHub public (and, coincidentally, Read-Only) Source-Release archive for Java Package java.util.*

    The Original '.java' Source-File's Header-Copyright Information is included here: File Copyright. Within that Copyright Notice, it is suggested that a copy of the GNU Public License V2 also be included alongside.
    Immutable variant of Java Collections Framework interface java.util.ListIterator<E>. This interface contains all of the methods that the standard Java interface ReadOnlyListIterator contains - except those which would directly or indirectly modify / mutate the internal data-structure.


    • Method Detail

      • hasNext

        🡇     🗕  🗗  🗖
        boolean hasNext()
        Returns TRUE if this list iterator has more elements when traversing the list in the forward direction. (In other words, returns TRUE if next() would return an element rather than throwing an exception.)
        Returns:
        TRUE if the list iterator has more elements when traversing the list in the forward direction
      • next

        🡅  🡇     🗕  🗗  🗖
        E next()
        Returns the next element in the list and advances the cursor position. This method may be called repeatedly to iterate through the list, or intermixed with calls to previous() to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)
        Returns:
        the next element in the list
        Throws:
        NoSuchElementException - if the iteration has no next element
      • hasPrevious

        🡅  🡇     🗕  🗗  🗖
        boolean hasPrevious()
        Returns TRUE if this list iterator has more elements when traversing the list in the reverse direction. (In other words, returns TRUE if previous() would return an element rather than throwing an exception.)
        Returns:
        TRUE if the list iterator has more elements when traversing the list in the reverse direction
      • previous

        🡅  🡇     🗕  🗗  🗖
        E previous()
        Returns the previous element in the list and moves the cursor position backwards. This method may be called repeatedly to iterate through the list backwards, or intermixed with calls to next() to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)
        Returns:
        the previous element in the list
        Throws:
        NoSuchElementException - if the iteration has no previous element
      • nextIndex

        🡅  🡇     🗕  🗗  🗖
        int nextIndex()
        Returns the index of the element that would be returned by a subsequent call to next(). (Returns list size if the list iterator is at the end of the list.)
        Returns:
        the index of the element that would be returned by a subsequent call to next, or list size if the list iterator is at the end of the list
      • previousIndex

        🡅     🗕  🗗  🗖
        int previousIndex()
        Returns the index of the element that would be returned by a subsequent call to previous(). (Returns -1 if the list iterator is at the beginning of the list.)
        Returns:
        the index of the element that would be returned by a subsequent call to previous, or -1 if the list iterator is at the beginning of the list