Sunday, June 17, 2012

Iterator Pattern

Intent

Iterator Pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation


We use iterators quite frequently in everyday life. For example, remote control of TV. We just pick up the TV remote control and start pressing Up and Down or Forward and Back keys to iterate through the channels.


Motivation
Need to traverse different data structures so that algorithms can be defined that are capable of interfacing with each transparently.



Reference:
http://kapilnevatia.blogspot.com/2011/12/iterator-pattern.html





No comments:

Post a Comment