Behavioral patterns

Iterator

Walk through a collection's elements one by one WITHOUT exposing how the collection stores them, and support multiple independent walks at once. An animated lesson where the diagram draws itself as the design grows.

  • Lesson 7 of 10
  • Animated diagrams

Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.

10 lessons, each with diagrams that draw themselves.

What you will learn

  • The idea: walk without looking inside
  • An analogy: the channel-up button
  • The mechanics: hasNext() and next()
  • External vs internal iterators
  • Why it pays off
  • Fail-fast and concurrent modification

More low-level design

Watch Iterator take shape

Sign in and the lesson opens with its diagram ready to play, and the rest of Behavioral patterns beside it.

DSA comes with the all labs plan and every ChaiCode batch.