- Java EE 8 Design Patterns and Best Practices
- Rhuan Rocha Jo?o Purifica??o
- 144字
- 2021-07-23 16:54:51
Explaining Iterator
Imagine that we want a way to access elements of an aggregate object sequentially without exposing its internal structure. The Iterator pattern does just that.
The Iterator pattern is responsible for sequentially accessing the aggregate object and defining an interface to access the elements without exposing the internal structure. This interface doesn't put a new element on the aggregate object, but simply reads elements to it. In the following diagram, you can see the structure of an Iterator and how it is designed:

In the preceding diagram, we can see the Aggregate and Iterator interfaces with their concrete subclasses. The client is the class that uses the Iterator to access elements of Aggregate.
This pattern is used on Java collections such as list, deque, and set. Understanding this pattern will help you to understand Java collections.
- Mastering ElasticSearch
- Mastering vRealize Operations Manager(Second Edition)
- Modern Web Testing with TestCafe
- Kali Linux滲透測試全流程詳解
- 混沌工程:復雜系統韌性實現之道
- 高性能Linux服務器構建實戰:系統安全、故障排查、自動化運維與集群架構
- Linux自動化運維:Shell與Ansible(微課版)
- 嵌入式實時操作系統:RT-Thread設計與實現
- Windows Server 2012網絡操作系統項目教程(第4版)
- Linux內核設計的藝術:圖解Linux操作系統架構設計與實現原理
- Cassandra 3.x High Availability(Second Edition)
- 跟老男孩學Linux運維:Shell編程實戰
- Linux軟件管理平臺設計與實現
- VMware Horizon Mirage Essentials
- Docker容器技術與應用