Change this method to return true here instead of break, and return false if you fall out of the loop.

Then below in next() you can use the return value of updatePath to know if you should just stop and not even look up the path in the tree again.