Iterator Pattern – Design Pattern

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

The iterator pattern allows traversal of elements of an aggregate without exposing the underlying implementation.

It also places the task of traversal on the iterator object, not on the aggregate, which simplifies the aggregate interface and implementation, and places the responsibility where it should be.

one thing to notice here

Aggregate or Collection means just a group of objects, they might be stored in very different data structures like lists, arrays, hashmaps, vectors etc.

This pattern comes in the scenario when we have a different kind of collections, and we need to traverse over them in a different class, class separate from implementing collections data.

below is diagram explaining iterator pattern.



4 Responses to Iterator Pattern – Design Pattern

  1. homebuilder says:

    Pretty cool blogging dude . Keep up the great posting

  2. konopie lecznicze polska says:

    Quality posts is the key to be a focus for the visitors to pay
    a quick visit the site, that’s what this web page is providing.

  3. kredyt bez bik says:

    Wonderful, what a website it is! This web site provides helpful information to us, keep it up.

  4. Adelaide weather Forecast says:

    Hello to all, the contents existing at this web
    site are in fact awesome for people knowledge, well, keep up the good work fellows.

Leave a Reply

Your email address will not be published. Required fields are marked *