Stop going over the rbtree if we already found the element we were looking for.