org.apache.commons.collections.list

Class AbstractLinkedList.LinkedListIterator

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

A list iterator over the linked list.
Field Summary
protected AbstractLinkedList.Nodecurrent
The last node that was returned by next or previous.
protected intexpectedModCount
The modification count that the list is expected to have.
protected AbstractLinkedList.Nodenext
The node that will be returned by next.
protected intnextIndex
The index of next.
protected AbstractLinkedListparent
The parent list
Constructor Summary
protected LinkedListIterator(AbstractLinkedList parent, int fromIndex)
Create a ListIterator for a list.
Method Summary
voidadd(Object obj)
protected voidcheckModCount()
Checks the modification count of the list is the value that this object expects.
protected AbstractLinkedList.NodegetLastNodeReturned()
Gets the last node returned.
booleanhasNext()
booleanhasPrevious()
Objectnext()
intnextIndex()
Objectprevious()
intpreviousIndex()
voidremove()
voidset(Object obj)

Field Detail

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. 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.

protected AbstractLinkedList.Node next
The node that will be returned by next. If this is equal to 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 Detail

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 Detail

add

public void add(Object obj)

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()
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.

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)
Copyright © 2001-2008 Apache Software Foundation. All Rights Reserved.