From the course: Programming Foundations: Design Patterns
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Challenge: The Iterator pattern
From the course: Programming Foundations: Design Patterns
Challenge: The Iterator pattern
(energetic music) - [Narrator] It's time for another challenge. For the iterator pattern, we're going to try something a little different. For this challenge, you'll need to do a little research before writing code. Most modern programming languages incorporate the iterator pattern. So it's valuable to learn how the iterator pattern is used in languages that are important to you. So pick one of your favorite programming languages. In that language, identify how the Iterator pattern is used to iterate over collections of objects. You might have to do a little bit of research to figure out which types are iterable, and what statements are used to iterate over those types of objects. After you've done your research, implement a small code example to iterate through an aggregate object like an array or a list in the language of your choice.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Encapsulating iteration1m 44s
-
(Locked)
Understanding the Iterator pattern2m 28s
-
(Locked)
Using the Iterator pattern3m 36s
-
(Locked)
Using built-in iterators1m 19s
-
(Locked)
The single responsibility principle1m 20s
-
(Locked)
The iterator pattern as language feature1m 30s
-
(Locked)
Challenge: The Iterator pattern57s
-
(Locked)
Solution: The Iterator pattern36s
-
(Locked)
-
-
-