Hi Ram,
Did you check this code execution in debug mode, where you are facing issue in above code?
some times if you check in debug system will show empty collection in iterator but still you can try accessing the corresponding entity from the iterator.
Another point to check, what is the variable iterator type declaration.
Best Regards,
Dharmakasi.