Package com.vladsch.flexmark.util.ast
Class NodeIterator
- java.lang.Object
-
- com.vladsch.flexmark.util.ast.NodeIterator
-
- All Implemented Interfaces:
com.vladsch.flexmark.util.collection.iteration.ReversibleIterator<Node>,com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterator<Node>,Iterator<Node>
public class NodeIterator extends Object implements com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterator<Node>
-
-
Constructor Summary
Constructors Constructor 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
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforEachRemaining(Consumer<? super Node> consumer)booleanhasNext()booleanisReversed()Nodenext()@Nullable Nodepeek()voidremove()Remove the last node returned bynext()
-
-
-
Field Detail
-
EMPTY
public static final com.vladsch.flexmark.util.collection.iteration.ReversiblePeekingIterator<Node> EMPTY
-
-
Constructor Detail
-
NodeIterator
public NodeIterator(Node firstNode)
- Parameters:
firstNode- node from which to start the iteration and continue until all sibling nodes have been traversed
-
NodeIterator
public NodeIterator(Node firstNode, boolean reversed)
- Parameters:
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 sibling
-
NodeIterator
public NodeIterator(Node firstNode, Node lastNode)
- Parameters:
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 traversed
-
NodeIterator
public NodeIterator(Node firstNode, Node lastNode, boolean reversed)
iterate nodes until null or last node is iterated over- Parameters:
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 sibling
-
-
Method Detail
-
isReversed
public boolean isReversed()
- Specified by:
isReversedin interfacecom.vladsch.flexmark.util.collection.iteration.ReversibleIterator<Node>- Returns:
- true if the iterator is a reversed iterator
-
hasNext
public boolean hasNext()
-
next
public Node next()
-
peek
@Nullable public @Nullable Node peek()
-
remove
public void remove()
Remove the last node returned bynext()
-
forEachRemaining
public void forEachRemaining(Consumer<? super Node> consumer)
- Specified by:
forEachRemainingin interfaceIterator<Node>
-
-