Package Torello.Java.ReadOnly
Interface ReadOnlyListIterator<E>
-
- Type Parameters:
E
- the type of elements returned by this list iterator
public interface ReadOnlyListIterator<E>
This interface was originally copied fromGitHub'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 Javainterface
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 theJDK-21 GitHub
public (and, coincidentally, Read-Only) Source-Release archive for Java Packagejava.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 theGNU Public License V2
also be included alongside.Immutable variant of Java Collections Framework interfacejava.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.
Hi-Lited Source-Code:- View Here: Torello/Java/ReadOnly/ReadOnlyListIterator.java
- Open New Browser-Tab: Torello/Java/ReadOnly/ReadOnlyListIterator.java
File Size: 4,773 Bytes Line Count: 107 '\n' Characters Found
-
-
Method Summary
Next Modifier and Type Method boolean
hasNext()
E
next()
int
nextIndex()
Previous Modifier and Type Method boolean
hasPrevious()
E
previous()
int
previousIndex()
-
-
-
Method Detail
-
hasNext
boolean hasNext()
ReturnsTRUE
if this list iterator has more elements when traversing the list in the forward direction. (In other words, returnsTRUE
ifnext()
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 toprevious()
to go back and forth. (Note that alternating calls tonext
andprevious
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()
ReturnsTRUE
if this list iterator has more elements when traversing the list in the reverse direction. (In other words, returnsTRUE
ifprevious()
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 tonext()
to go back and forth. (Note that alternating calls tonext
andprevious
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 tonext()
. (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 toprevious()
. (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
-
-