Iterator design pattern example.