java.util.Iterator
, java.util.ListIterator
, OrderedIterator
AbstractLinkedList.LinkedSubListIterator
, CursorableLinkedList.Cursor
protected static class AbstractLinkedList.LinkedListIterator extends java.lang.Object implements java.util.ListIterator, OrderedIterator
Modifier and Type | Field | Description |
---|---|---|
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
|
Modifier | Constructor | Description |
---|---|---|
protected |
LinkedListIterator(AbstractLinkedList parent,
int fromIndex) |
Create a ListIterator for a list.
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(java.lang.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 element that can be iterated to.
|
java.lang.Object |
next() |
|
int |
nextIndex() |
|
java.lang.Object |
previous() |
Gets the previous element from the collection.
|
int |
previousIndex() |
|
void |
remove() |
|
void |
set(java.lang.Object obj) |
protected final AbstractLinkedList parent
protected AbstractLinkedList.Node next
next()
. If this is equal
to AbstractLinkedList.header
then there are no more values to return.protected int nextIndex
next
.protected AbstractLinkedList.Node current
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.protected int expectedModCount
ConcurrentModificationException
may be thrown by
the operations.protected LinkedListIterator(AbstractLinkedList parent, int fromIndex) throws java.lang.IndexOutOfBoundsException
parent
- the parent listfromIndex
- the index to start atjava.lang.IndexOutOfBoundsException
protected void checkModCount()
java.util.ConcurrentModificationException
- If the list's modification
count isn't the value that was expected.protected AbstractLinkedList.Node getLastNodeReturned() throws java.lang.IllegalStateException
java.lang.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)
.public boolean hasNext()
hasNext
in interface java.util.Iterator
hasNext
in interface java.util.ListIterator
public java.lang.Object next()
next
in interface java.util.Iterator
next
in interface java.util.ListIterator
public boolean hasPrevious()
OrderedIterator
hasPrevious
in interface java.util.ListIterator
hasPrevious
in interface OrderedIterator
true
if the iterator has a previous elementpublic java.lang.Object previous()
OrderedIterator
previous
in interface java.util.ListIterator
previous
in interface OrderedIterator
public int nextIndex()
nextIndex
in interface java.util.ListIterator
public int previousIndex()
previousIndex
in interface java.util.ListIterator
public void remove()
remove
in interface java.util.Iterator
remove
in interface java.util.ListIterator
public void set(java.lang.Object obj)
set
in interface java.util.ListIterator
public void add(java.lang.Object obj)
add
in interface java.util.ListIterator
Copyright © 2001-2017 Apache Software Foundation. All Rights Reserved.