- Hands-On Design Patterns with Java
- Dr. Edward Lavieri
- 146字
- 2021-06-24 14:58:08
Using the iterator pattern
The purpose of the iterator design pattern is to grant access to an object's members without sharing the encapsulated data structures. There are two main motivations for using the iterator design pattern. First, not all object data is stored in the same manner. For example, an online store that aggregates content from other vendors might have a vendor that uses an array, another that uses a list, and a third that uses an ArrayList. A second reason is to avoid exposing data structures. Both the variability of storage approaches and data security can be addressed with the iterator design pattern.
The iterator design pattern is implemented by using the Iterator interface, part of the java.util package.
We will look at a simple use case, the UML class diagram, and the source code necessary to implement the iterator design pattern for this scenario.
- 有趣的二進制:軟件安全與逆向分析
- 從0到1:數(shù)據(jù)分析師養(yǎng)成寶典
- SQL Server 2008數(shù)據(jù)庫應(yīng)用技術(shù)(第二版)
- 文本數(shù)據(jù)挖掘:基于R語言
- Creating Dynamic UIs with Android Fragments(Second Edition)
- Spark核心技術(shù)與高級應(yīng)用
- Dependency Injection with AngularJS
- 智能數(shù)據(jù)分析:入門、實戰(zhàn)與平臺構(gòu)建
- OracleDBA實戰(zhàn)攻略:運維管理、診斷優(yōu)化、高可用與最佳實踐
- LabVIEW 完全自學(xué)手冊
- R語言數(shù)據(jù)挖掘
- HikariCP連接池實戰(zhàn)
- 從實踐中學(xué)習(xí)sqlmap數(shù)據(jù)庫注入測試
- Internet of Things with Python
- PostgreSQL高可用實戰(zhàn)