Iterator Design Pattern

What is the Iterator Design Pattern?

  • The Iterator pattern provides you with a uniform way to access different collections of Objects.
  • If you get an Array, ArrayList and Hashtable of Objects, you pop out an iterator for each and treat them the same
  • This provides a uniform way to cycle through different collections.
  • You can also write polymorphic code because you can refer to each collection of objects because they'll implement the same interface.

(To be continued)

Guess you like

Origin www.cnblogs.com/codingyangmao/p/11226999.html