Avoid duplicate search by reusing the iterator.