# Class AbstractLinkedListJava21.LinkedSubListIterator<E>

java.lang.Object
org.apache.commons.collections4.list.AbstractLinkedListJava21.LinkedListIterator<E>
org.apache.commons.collections4.list.AbstractLinkedListJava21.LinkedSubListIterator<E>

Type Parameters:
  `E` - the type of elements in this iterator.

All Implemented Interfaces:
  `Iterator<E>`, `ListIterator<E>`, `OrderedIterator<E>`

Enclosing class:
  `AbstractLinkedListJava21<E>`

protected static class AbstractLinkedListJava21.LinkedSubListIterator<E> extends AbstractLinkedListJava21.LinkedListIterator<E>
A list iterator over the linked sub list.

Since:
  4.5.0-M3

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final AbstractLinkedListJava21.LinkedSubList<E>`
  `sub`
  The sub list

  ### Fields inherited from class org.apache.commons.collections4.list.AbstractLinkedListJava21.LinkedListIterator

  `current, expectedModCount, next, nextIndex, parent`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `LinkedSubListIterator(AbstractLinkedListJava21.LinkedSubList<E> sub, int startIndex)`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(E obj)`
  `boolean`
  `hasNext()`
  `boolean`
  `hasPrevious()`
  Checks to see if there is a previous element that can be iterated to.
  `int`
  `nextIndex()`
  `void`
  `remove()`

  ### Methods inherited from class org.apache.commons.collections4.list.AbstractLinkedListJava21.LinkedListIterator

  `checkModCount, getLastNodeReturned, next, previous, previousIndex, set`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.util.Iterator

  `forEachRemaining`

- ## Field Details

  - ### sub

    protected final AbstractLinkedListJava21.LinkedSubList<E> sub
    The sub list

- ## Constructor Details

  - ### LinkedSubListIterator

    protected LinkedSubListIterator(AbstractLinkedListJava21.LinkedSubList<E> sub, int startIndex)
    Constructs a new instance.
    Parameters:
      `sub` - The sub-list.
      `startIndex` - The starting index.

- ## Method Details

  - ### add

    public void add(E obj)
    Specified by:
      `add` in interface `ListIterator<E>`
    Overrides:
      `add` in class `AbstractLinkedListJava21.LinkedListIterator<E>`

  - ### hasNext

    public boolean hasNext()
    Specified by:
      `hasNext` in interface `Iterator<E>`
    Specified by:
      `hasNext` in interface `ListIterator<E>`
    Overrides:
      `hasNext` in class `AbstractLinkedListJava21.LinkedListIterator<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 `ListIterator<E>`
    Specified by:
      `hasPrevious` in interface `OrderedIterator<E>`
    Overrides:
      `hasPrevious` in class `AbstractLinkedListJava21.LinkedListIterator<E>`
    Returns:
      `true` if the iterator has a previous element

  - ### nextIndex

    public int nextIndex()
    Specified by:
      `nextIndex` in interface `ListIterator<E>`
    Overrides:
      `nextIndex` in class `AbstractLinkedListJava21.LinkedListIterator<E>`

  - ### remove

    public void remove()
    Specified by:
      `remove` in interface `Iterator<E>`
    Specified by:
      `remove` in interface `ListIterator<E>`
    Overrides:
      `remove` in class `AbstractLinkedListJava21.LinkedListIterator<E>`