The iterator design pattern