Iterator: sync post code blocks to repo exactly, Java 25, add H6 file labels and README mapping, fix stale console output

This commit is contained in:
2026-06-24 16:43:21 +05:30
parent 967d490323
commit 7b156a7c50
2 changed files with 48 additions and 0 deletions

View File

@@ -338,6 +338,23 @@ javac 03-behavioral/command/*.java -d out/command
java -cp out/command command.Main
```
### Iterator (`03-behavioral/iterator/`)
| Post Section | File(s) |
|---|---|
| Custom Iterator Implementation — the Iterator interface | `BookIterator.java` |
| Custom Iterator Implementation — the element type | `Book.java` |
| Custom Iterator Implementation — the Aggregate (BookShelf, ForwardIterator, DecadeIterator) | `BookShelf.java` |
| Custom Iterator Implementation — wiring it together | `Main.java` |
Note: the "How Java's For-Each Loop Uses Iterator" snippet (`Iterable<Book>` example) is illustrative only — it is not part of this repository's runnable example.
Run it:
```bash
javac 03-behavioral/iterator/*.java -d out/iterator
java -cp out/iterator iterator.Main
```
## Reference
- *Design Patterns: Elements of Reusable Object-Oriented Software* — Gamma, Helm, Johnson, Vlissides