iterator pattern example