Iterators give you the ability to navigate from one item to another in a collection. Why is this so special? Now that you know how to work with various collections, you know that they’re structured very differently. An array just needs to move a pointer to the next item. A list needs to follow wherever the next pointer leads. A binary tree needs to go up and down the tree. Iterators give you a common way to navigate no matter what kind of collection you’re using.

If you have a collection like this:

Then you can access the first number in the list like this:

And you can access the end iterator like this:

Then you can create a for loop to process items in the list like this: