jodd-lagarto/src/main/java/jodd/lagarto/dom/NodeSelector.java
protected void walkDescendantsIteratively(final LinkedList<Node> nodes, final CssSelector cssSelector, final List<Node> result) {
		while (!nodes.isEmpty()) {
			Node node = nodes.removeFirst();
			selectAndAdd(node, cssSelector, result);

			// append children in walking order to be processed right after this node
			int childCount = node.getChildNodesCount();
			for (int i = childCount - 1; i >= 0; i--) {
				nodes.addFirst(node.getChild(i));
			}
		}
	}
protected void walkDescendantsIteratively(final LinkedList<Node> nodes, final CssSelector cssSelector, final List<Node> result) {
		while (!nodes.isEmpty()) {
			Node node = nodes.removeFirst();
			selectAndAdd(node, cssSelector, result);

			// append children in walking order to be processed right after this node
			int childCount = node.getChildNodesCount();
			for (int i = childCount - 1; i >= 0; i--) {
				nodes.addFirst(node.getChild(i));
			}
		}
	}
protected void walkDescendantsIteratively ( final LinkedList < Node > nodes , final CssSelector cssSelector , final List < Node > result ) { while ( ! nodes . isEmpty ( ) ) { Node node = nodes . removeFirst ( ) ; selectAndAdd ( node , cssSelector , result ) ; // append children in walking order to be processed right after this node int childCount = node . getChildNodesCount ( ) ; for ( int i = childCount - 1 ; i >= 0 ; i -- ) { nodes . addFirst ( node . getChild ( i ) ) ; } } }
Walks over the child notes, maintaining the tree order and not using recursion.
Walks over the child notes maintaining the tree order and not using recursion .