- java.lang.Object
-
- org.jgrapht.util.DoublyLinkedList.ListNodeIteratorImpl
-
- All Implemented Interfaces:
java.util.Iterator<E>
,java.util.ListIterator<E>
,DoublyLinkedList.ListNodeIterator<E>
,DoublyLinkedList.NodeIterator<E>
- Enclosing class:
- DoublyLinkedList<E>
private class DoublyLinkedList.ListNodeIteratorImpl extends java.lang.Object implements DoublyLinkedList.ListNodeIterator<E>
An implementation of theDoublyLinkedList.ListNodeIterator
interface.
-
-
Field Summary
Fields Modifier and Type Field Description private int
expectedModCount
The number of modifications the list have had at the moment when this iterator was createdprivate DoublyLinkedList.ListNodeImpl<E>
last
ListNode this iterator returned last.private DoublyLinkedList.ListNodeImpl<E>
next
ListNode this iterator will return next.private int
nextIndex
Index in this list of the ListNode returned next.
-
Constructor Summary
Constructors Modifier Constructor Description private
ListNodeIteratorImpl(int startIndex)
private
ListNodeIteratorImpl(int startIndex, DoublyLinkedList.ListNodeImpl<E> startNode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(E e)
private void
checkForComodification()
Verifies that the list structure hasn't been changed since the iteration startedboolean
hasNext()
boolean
hasPrevious()
int
nextIndex()
DoublyLinkedList.ListNodeImpl<E>
nextNode()
Returns the nextDoublyLinkedList.ListNode
in the list and advances the cursor position.int
previousIndex()
DoublyLinkedList.ListNode<E>
previousNode()
Returns the previousDoublyLinkedList.ListNode
in the list and moves the cursor position backwards.void
remove()
void
set(E e)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jgrapht.util.DoublyLinkedList.ListNodeIterator
next, previous
-
-
-
-
Field Detail
-
nextIndex
private int nextIndex
Index in this list of the ListNode returned next.
-
next
private DoublyLinkedList.ListNodeImpl<E> next
ListNode this iterator will return next. Null if this list is empty.
-
last
private DoublyLinkedList.ListNodeImpl<E> last
ListNode this iterator returned last.
-
expectedModCount
private int expectedModCount
The number of modifications the list have had at the moment when this iterator was created
-
-
Constructor Detail
-
ListNodeIteratorImpl
private ListNodeIteratorImpl(int startIndex)
-
ListNodeIteratorImpl
private ListNodeIteratorImpl(int startIndex, DoublyLinkedList.ListNodeImpl<E> startNode)
-
-
Method Detail
-
hasNext
public boolean hasNext()
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPrevious
in interfacejava.util.ListIterator<E>
-
nextIndex
public int nextIndex()
- Specified by:
nextIndex
in interfacejava.util.ListIterator<E>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndex
in interfacejava.util.ListIterator<E>
-
nextNode
public DoublyLinkedList.ListNodeImpl<E> nextNode()
Returns the nextDoublyLinkedList.ListNode
in the list and advances the cursor position.- Specified by:
nextNode
in interfaceDoublyLinkedList.NodeIterator<E>
- Returns:
- the next
ListNode
- See Also:
ListIterator.next()
-
previousNode
public DoublyLinkedList.ListNode<E> previousNode()
Returns the previousDoublyLinkedList.ListNode
in the list and moves the cursor position backwards.- Specified by:
previousNode
in interfaceDoublyLinkedList.ListNodeIterator<E>
- Returns:
- the previous
ListNode
- See Also:
ListIterator.previous()
-
remove
public void remove()
-
checkForComodification
private void checkForComodification()
Verifies that the list structure hasn't been changed since the iteration started
-
-