Datasheet
DESIGN PATTERNS IN WEB FRAMEWORKS
x
27
of traversal can be produced for both of them. When Client calls the next() method, different
ordering algorithms are executed for List and for Map, but in both cases a subsequent element is
found.
+createTraversalObject() : TraversalAbstraction
+first()
+next()
+isDone()
+createTraversalObject()+createTraversalObject()
Client
ListTraversal ListTraversal
ListCollection MapCollection
TraversalAbstraction
Collection
FIGURE 126: Iterator pattern structure
In web frameworks the Iterator pattern is used mainly for pagination. You need a uniform interface
to divide web content into adequate pieces, turn them into separate web pages, and then traverse
through them.
c01.indd 27c01.indd 27 1/24/2011 5:45:21 PM1/24/2011 5:45:21 PM