- 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.
- 達(dá)夢(mèng)數(shù)據(jù)庫(kù)編程指南
- 揭秘云計(jì)算與大數(shù)據(jù)
- 醫(yī)療大數(shù)據(jù)挖掘與可視化
- iOS and OS X Network Programming Cookbook
- Oracle高性能自動(dòng)化運(yùn)維
- 大話Oracle Grid:云時(shí)代的RAC
- Python金融實(shí)戰(zhàn)
- Proxmox VE超融合集群實(shí)踐真?zhèn)?/a>
- INSTANT Apple iBooks How-to
- HikariCP連接池實(shí)戰(zhàn)
- 編寫有效用例
- TextMate How-to
- 爬蟲實(shí)戰(zhàn):從數(shù)據(jù)到產(chǎn)品
- 大數(shù)據(jù)技術(shù)原理與應(yīng)用:概念、存儲(chǔ)、處理、分析與應(yīng)用
- 數(shù)據(jù)挖掘競(jìng)賽實(shí)戰(zhàn):方法與案例