- 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.
- PLC控制程序精編108例
- Puppet實(shí)戰(zhàn)
- 網(wǎng)絡(luò)操作系統(tǒng):Windows Server 2003管理與應(yīng)用
- Linux性能優(yōu)化
- Ubuntu Linux操作系統(tǒng)
- Windows 7中文版從入門到精通(修訂版)
- 8051軟核處理器設(shè)計(jì)實(shí)戰(zhàn)
- 蘋果OS X Mavericks 10.9應(yīng)用大全
- 計(jì)算機(jī)系統(tǒng)的自主設(shè)計(jì)
- Windows 7使用詳解(修訂版)
- Linux內(nèi)核API完全參考手冊(第2版)
- 完美應(yīng)用Ubuntu(第2版)
- Linux內(nèi)核修煉之道
- 電腦辦公(Windows10+Office2016)從新手到高手
- 蘋果派