Guidewire interview question

Implement an iterator class for the given scenario in java