Iterator
结构  设计模式——迭代模式
意图 提供一种方法顺序访问一个聚合对象中各个元素, 而又不需暴露该对象的内部表示。
适用性
  • 访问一个聚合对象的内容而无需暴露它的内部表示。
  • 支持对聚合对象的多种遍历。
  • 为遍历不同的聚合结构提供一个统一的接口(即, 支持多态迭代)。
Code Example
  1设计模式——迭代模式// Iterator
  2设计模式——迭代模式
  3设计模式——迭代模式// Intent: "Provide a way to access the elements of an aggregate object 
  4设计模式——迭代模式// sequentially without exposing its underlying representation". 
  5设计模式——迭代模式
  6设计模式——迭代模式// For further information, read "Design Patterns", p257, Gamma et al.,
  7设计模式——迭代模式// Addison-Wesley, ISBN:0-201-63361-2
  8设计模式——迭代模式
  9

相关文章:

  • 2021-10-11
  • 2022-02-09
猜你喜欢
  • 2021-08-27
  • 2021-09-23
  • 2021-12-22
  • 2021-10-28
  • 2021-09-25
相关资源
相似解决方案