iterator pattern demo