You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: iterator/README.md
+99Lines changed: 99 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,105 @@ Cursor
15
15
Provide a way to access the elements of an aggregate object
16
16
sequentially without exposing its underlying representation.
17
17
18
+
## Explanation
19
+
20
+
Real world example
21
+
22
+
> Treasure chest contains a set of magical items. There multiple types of items such as rings, potions and weapons. The items can be browsed by type using an iterator the treasure chest provides.
23
+
24
+
In plain words
25
+
26
+
> Containers can provide a representation agnostic iterator interface to provide access to the elements.
27
+
28
+
Wikipedia says
29
+
30
+
> In object-oriented programming, the iterator pattern is a design pattern in which an iterator is used to traverse a container and access the container's elements.
31
+
32
+
**Programmatic Example**
33
+
34
+
The main class in our example is the treasure chest that contains items.
0 commit comments