Skip to content

Commit f121ccc

Browse files
committed
Add README.
1 parent 2f8df73 commit f121ccc

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Iterator pattern
2+
Iterator is a behavioral design pattern that lets you traverse elements of a collection without
3+
exposing its underlying representation (list, stack, tree, etc.).
4+
5+
Tutorial: [here](https://refactoring.guru/design-patterns/iterator).
6+
7+
### Client code:
8+
```dart
9+
void main() {
10+
final text = Text(
11+
'Iterator is a behavioral design pattern that lets you traverse elements '
12+
'of a collection without exposing its underlying representation '
13+
'(list, stack, tree, etc.).',
14+
);
15+
16+
for (final s in text) {
17+
print(s);
18+
}
19+
}
20+
```
21+
22+
**Output:**
23+
```
24+
Iterator
25+
is
26+
a
27+
behavioral
28+
design
29+
pattern
30+
that
31+
lets
32+
you
33+
traverse
34+
elements
35+
of
36+
a
37+
collection
38+
without
39+
exposing
40+
its
41+
underlying
42+
representation
43+
list
44+
stack
45+
tree
46+
etc
47+
```

0 commit comments

Comments
 (0)