Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.collections.list
Class AbstractLinkedList.LinkedListIterator

    java.lang.Object
      |
      +--org.apache.commons.collections.list.AbstractLinkedList.LinkedListIterator

All Implemented Interfaces:
  Iterator, ListIterator, OrderedIterator

Direct Known Subclasses:
  AbstractLinkedList.LinkedSubListIterator, CursorableLinkedList.Cursor

Enclosing class:
  AbstractLinkedList

protected static class AbstractLinkedList.LinkedListIterator
extends Object
implements ListIterator, OrderedIterator

A list iterator over the linked list.

Field Summary
`protected AbstractLinkedList.Node` | `current` The last node that was returned by `next()` or `previous()`.
`protected int` | `expectedModCount` The modification count that the list is expected to have.
`protected AbstractLinkedList.Node` | `next` The node that will be returned by `next()`.
`protected int` | `nextIndex` The index of `next`.
`protected AbstractLinkedList` | `parent` The parent list

Constructor Summary
`protected` | `AbstractLinkedList.LinkedListIterator(AbstractLinkedList parent, int fromIndex)` Create a ListIterator for a list.

Method Summary
`void` | `add(Object obj)`
`protected void` | `checkModCount()` Checks the modification count of the list is the value that this object expects.
`protected AbstractLinkedList.Node` | `getLastNodeReturned()` Gets the last node returned.
`boolean` | `hasNext()`
`boolean` | `hasPrevious()` Checks to see if there is a previous entry that can be iterated to.
`Object` | `next()`
`int` | `nextIndex()`
`Object` | `previous()` Gets the previous element from the collection.
`int` | `previousIndex()`
`void` | `remove()`
`void` | `set(Object obj)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### parent

    protected final AbstractLinkedList parent

  The parent list

### next

    protected AbstractLinkedList.Node next

  The node that will be returned by `next()`. If this is equal to `AbstractLinkedList.header` then there are no more values to return.

### nextIndex

    protected int nextIndex

  The index of `next`.

### current

    protected AbstractLinkedList.Node current

  The last node that was returned by `next()` or `previous()`. Set to `null` 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)`. Should be accessed through `getLastNodeReturned()` to enforce this behaviour.

### expectedModCount

    protected int expectedModCount

  The modification count that the list is expected to have. If the list doesn't have this count, then a `ConcurrentModificationException` may be thrown by the operations.

Constructor Detail

### AbstractLinkedList.LinkedListIterator

    protected AbstractLinkedList.LinkedListIterator(AbstractLinkedList parent,
                                                    int fromIndex)
                                             throws IndexOutOfBoundsException

  Create a ListIterator for a list.

Parameters:
  `parent` - the parent list
  `fromIndex` - the index to start at

Method Detail

### checkModCount

    protected void checkModCount()

  Checks the modification count of the list is the value that this object expects.

  Throws:
    `ConcurrentModificationException` - If the list's modification count isn't the value that was expected.

### getLastNodeReturned

    protected AbstractLinkedList.Node getLastNodeReturned()
                                                   throws IllegalStateException

  Gets the last node returned.

  Throws:
    `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 `ListIterator`

### next

    public Object next()

  Specified by:
    `next` in interface `ListIterator`

### hasPrevious

    public boolean hasPrevious()

  Description copied from interface: `OrderedIterator`
  Checks to see if there is a previous entry that can be iterated to.

  Specified by:
    `hasPrevious` in interface `ListIterator`
  Returns:
    `true` if the iterator has a previous element

### previous

    public Object previous()

  Description copied from interface: `OrderedIterator`
  Gets the previous element from the collection.

  Specified by:
    `previous` in interface `ListIterator`
  Returns:
    the previous key in the iteration

### nextIndex

    public int nextIndex()

  Specified by:
    `nextIndex` in interface `ListIterator`

### previousIndex

    public int previousIndex()

  Specified by:
    `previousIndex` in interface `ListIterator`

### remove

    public void remove()

  Specified by:
    `remove` in interface `ListIterator`

### set

    public void set(Object obj)

  Specified by:
    `set` in interface `ListIterator`

### add

    public void add(Object obj)

  Specified by:
    `add` in interface `ListIterator`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.