Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14: Iterator > When Would You Use the Iterator Pattern?

When Would You Use the Iterator Pattern?

You’d naturally think of using the Iterator pattern when

  • You need to access contents of a composite object without exposing its internal representation.
  • You need to traverse composite objects in multiple ways.
  • You need to provide a uniform interface for traversing different types of composite objects.

In the following sections, we are going to implement the pattern with iterators that traverse scribbles in the TouchPainter example app that we saw in Chapter 2.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint