设计模式之迭代器模式-2. UML 类图

时间:2024-09-30 15:12:11
+------------------+
|    Iterator      |
+------------------+
| +next()          |
| +hasNext()      |
+------------------+
        ^
        |
+------------------+
| ConcreteIterator  |
+------------------+
| -collection: Collection |
| -index: int            |
+------------------+
| +next()          |
| +hasNext()      |
+------------------+

+------------------+
|    Aggregate     |
+------------------+
| +createIterator()|
+------------------+
        ^
        |
+------------------+
| ConcreteAggregate|
+------------------+
| -items: List     |
+------------------+
| +createIterator()|
+------------------+