Package org.jsoup.nodes
Class NodeIterator<T extends Node>
java.lang.Object
org.jsoup.nodes.NodeIterator<T>
- All Implemented Interfaces:
Iterator<T>
Iterate through a Node and its tree of descendants, in document order, and returns nodes of the specified type. This
iterator supports structural changes to the tree during the traversal, such as
Node.remove(),
Node.replaceWith(Node), Node.wrap(String), etc.
See also the NodeTraversor if head and tail callbacks are
desired for each node.
- Since:
- 1.17.1
-
Constructor Summary
ConstructorsConstructorDescriptionNodeIterator(Node start, Class<T> type) Create a NoteIterator that will iterate the supplied node, and all of its descendants. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
NodeIterator
Create a NoteIterator that will iterate the supplied node, and all of its descendants. The returnednexttype will be filtered to the input type.- Parameters:
start- initial nodetype- node type to filter for
-
-
Method Details
-
from
Create a NoteIterator that will iterate the supplied node, and all of its descendants. All node types will be returned.- Parameters:
start- initial node
-
restart
Restart this Iterator from the specified start node. Will act as if it were newly constructed. Useful for e.g. to save some GC if the iterator is used in a tight loop.- Parameters:
start- the new start node.
-
hasNext
-
next
-
remove
-