⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
org.apache.commons.collections.list

Class AbstractLinkedList.LinkedListIterator

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

All Implemented Interfaces:
ListIterator,
OrderedIterator

Known Direct Subclasses:
AbstractLinkedList.LinkedSubListIterator, CursorableLinkedList.Cursor


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

A list iterator over the linked list.

Field Summary

AbstractLinkedList.Node

current

The last node that was returned by #next() or #previous().

int

expectedModCount

The modification count that the list is expected to have.

AbstractLinkedList.Node

next

The node that will be returned by #next().

int

nextIndex

The index of #next.

AbstractLinkedList

parent

The parent list

Constructor Summary

LinkedListIterator(AbstractLinkedList parent, int fromIndex)

Create a ListIterator for a list.

Method Summary

void

add(Object obj)

void

checkModCount()

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

AbstractLinkedList.Node

getLastNodeReturned()

Gets the last node returned.

boolean

hasNext()

boolean

hasPrevious()

Object

next()

int

nextIndex()

Object

previous()

int

previousIndex()

void

remove()

void

set(Object obj)

Field Details

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 java.util.ConcurrentModificationException may be thrown by the operations.


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.


parent

protected final AbstractLinkedList parent

The parent list

Constructor Details

LinkedListIterator

protected LinkedListIterator(AbstractLinkedList parent, int fromIndex)

Create a ListIterator for a list.

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

Method Details

add

public void add(Object obj)

Parameters:
obj

checkModCount

protected void checkModCount()

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

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

getLastNodeReturned

protected AbstractLinkedList.Node getLastNodeReturned()

Gets the last node returned. previous() haven't been called, or if the node has been removed with remove() or a new node added with add(Object).

Throws:
- If #next() or

hasNext

public boolean hasNext()


hasPrevious

public boolean hasPrevious()


next

public Object next()


nextIndex

public int nextIndex()


previous

public Object previous()


previousIndex

public int previousIndex()


remove

public void remove()


set

public void set(Object obj)

Parameters:
obj