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()

Reply via email to