org.apache.commons.collections.list

## Class CursorableLinkedList.SubCursor

- java.lang.Object
- - org.apache.commons.collections.list.AbstractLinkedList.LinkedListIterator
  - - org.apache.commons.collections.list.CursorableLinkedList.Cursor
    - - org.apache.commons.collections.list.CursorableLinkedList.SubCursor

- All Implemented Interfaces:
    Iterator, ListIterator, OrderedIterator
  Enclosing class:
    CursorableLinkedList

      protected static class CursorableLinkedList.SubCursor
      extends CursorableLinkedList.Cursor

  A cursor for the sublist based on LinkedSubListIterator.
  Since:
    Commons Collections 3.2

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AbstractLinkedList.LinkedSubList` | `sub` The parent list

    - ### Fields inherited from class org.apache.commons.collections.list.AbstractLinkedList.LinkedListIterator

      `current, expectedModCount, next, nextIndex, parent`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `CursorableLinkedList.SubCursor(AbstractLinkedList.LinkedSubList sub, int index)` Constructs a new cursor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Object obj)` Adds an object to the list.
    `boolean` | `hasNext()`
    `boolean` | `hasPrevious()` Checks to see if there is a previous element that can be iterated to.
    `int` | `nextIndex()` Gets the index of the next element to be returned.
    `void` | `remove()` Removes the item last returned by this iterator.

    - ### Methods inherited from class org.apache.commons.collections.list.CursorableLinkedList.Cursor

      `checkModCount, close, nodeChanged, nodeInserted, nodeRemoved`

    - ### Methods inherited from class org.apache.commons.collections.list.AbstractLinkedList.LinkedListIterator

      `getLastNodeReturned, next, previous, previousIndex, set`

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

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

- - ### Field Detail

    - #### sub

          protected final AbstractLinkedList.LinkedSubList sub

      The parent list

  - ### Constructor Detail

    - #### CursorableLinkedList.SubCursor

          protected CursorableLinkedList.SubCursor(AbstractLinkedList.LinkedSubList sub,
                                        int index)

      Constructs a new cursor.
      Parameters:
        `index` - the index to start from

  - ### Method Detail

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in interface `Iterator`
      Specified by:
        `hasNext` in interface `ListIterator`
      Overrides:
        `hasNext` in class `AbstractLinkedList.LinkedListIterator`

    - #### 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`
      Specified by:
        `hasPrevious` in interface `OrderedIterator`
      Overrides:
        `hasPrevious` in class `AbstractLinkedList.LinkedListIterator`
      Returns:
        `true` if the iterator has a previous element

    - #### nextIndex

          public int nextIndex()

      Description copied from class: `CursorableLinkedList.Cursor`
      Gets the index of the next element to be returned.
      Specified by:
        `nextIndex` in interface `ListIterator`
      Overrides:
        `nextIndex` in class `CursorableLinkedList.Cursor`
      Returns:
        the next index

    - #### add

          public void add(Object obj)

      Description copied from class: `CursorableLinkedList.Cursor`
      Adds an object to the list. The object added here will be the new 'previous' in the iterator.
      Specified by:
        `add` in interface `ListIterator`
      Overrides:
        `add` in class `CursorableLinkedList.Cursor`
      Parameters:
        `obj` - the object to add

    - #### remove

          public void remove()

      Description copied from class: `CursorableLinkedList.Cursor`
      Removes the item last returned by this iterator.

      There may have been subsequent alterations to the list since you obtained this item, however you can still remove it. You can even remove it if the item is no longer in the main list. However, you can't call this method on the same iterator more than once without calling next() or previous().

      Specified by:
        `remove` in interface `Iterator`
      Specified by:
        `remove` in interface `ListIterator`
      Overrides:
        `remove` in class `CursorableLinkedList.Cursor`

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.