When selecting 1.2 as the root, the normal DepthFirstTreeIterator would stop on 1.2 as it does not have children,
but this iterator will visit the next sibling (1.3 and 1.4 but not1.1) nodes. So the expected traversal order will be
1.2, 1.3, 1.3.1, 1.3.2, and 1.4 then jumps to 2 and continues with 2.1.
This tree iterator visits all nodes from top to bottom considering the following rules.
Let assume the following tree:
When selecting
1.2
as the root, the normalDepthFirstTreeIterator
would stop on1.2
as it does not have children, but this iterator will visit the next sibling (1.3
and1.4
but not1.1
) nodes. So the expected traversal order will be1.2
,1.3
,1.3.1
,1.3.2
, and1.4
then jumps to2
and continues with2.1
.