public class NodeIterator extends Object implements ReversiblePeekingIterator<Node>
| Modifier and Type | Field and Description |
|---|---|
static ReversiblePeekingIterator<Node> |
EMPTY |
| Constructor and Description |
|---|
NodeIterator(Node firstNode) |
NodeIterator(Node firstNode,
boolean reversed) |
NodeIterator(Node firstNode,
Node lastNode) |
NodeIterator(Node firstNode,
Node lastNode,
boolean reversed)
iterate nodes until null or last node is iterated over
|
| Modifier and Type | Method and Description |
|---|---|
void |
forEachRemaining(Consumer<? super Node> consumer) |
boolean |
hasNext() |
boolean |
isReversed() |
Node |
next() |
Node |
peek() |
void |
remove()
Remove the last node returned by
next() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic static final ReversiblePeekingIterator<Node> EMPTY
public NodeIterator(Node firstNode)
firstNode - node from which to start the iteration and continue until all sibling nodes have been traversedpublic NodeIterator(Node firstNode, boolean reversed)
firstNode - node from which to start the iteration and continue until all sibling nodes have been traversedreversed - true/false if the nodes are to be traversed in reverse order. If true the nodes previous sibling will be used instead of next siblingpublic NodeIterator(Node firstNode, Node lastNode)
firstNode - node from which to start the iteration and continue until all sibling nodes have been traversed or lastNode has been traversedlastNode - the last node to be traversedpublic NodeIterator(Node firstNode, Node lastNode, boolean reversed)
firstNode - node from which to start the iteration and continue until all sibling nodes have been traversed or lastNode has been traversedlastNode - the last node to be traversedreversed - true/false if the nodes are to be traversed in reverse order. If true the nodes previous sibling will be used instead of next siblingpublic boolean isReversed()
isReversed in interface ReversibleIterator<Node>public boolean hasNext()
public Node next()
public Node peek()
peek in interface ReversiblePeekingIterator<Node>next() or null if there is no next node.public void remove()
next()Copyright © 2018. All rights reserved.