while (iterator.hasNext()){
Object next = it.next()
doSomethingWith(next)
if (!childrenAreInteresting(next)){
it.prune() // this skips the subtree of the current element
}
}
This should be iterator.prune()
while (iterator.hasNext()){
Object next = it.next()
doSomethingWith(next)
if (!childrenAreInteresting(next)){
it.prune() // this skips the subtree of the current element
}
}
This should be iterator.prune()