…We've re-implemented the cafe in the…iterator built-in folder in the example files.…Notice that we no longer have an iterator interface…because we're using the Java util, iterator interface instead.…We've also removed the iterator for the pancake house menu.…Let's take a look at the create iterator in the pancake house menu.…And see how that's changed.…Instead of creating and returning a Pancake House Menu…iterator object, now we're calling the iterator method…of the menuItems ArrayList, and returning the resulting iterator.…

We know that the iterator implements the java.util iterator interface, so we…don't have to worry at all about how the iterator is implemented.…We can just use it.…And that's the only change we made to the file.…The rest is the same. We've kept the diner menu iterator class.…But now this class implements the Java…util iterator interface.…Which means that we had to add a remove method.…The remove method removes the item retrieved with…the most recent call to the next method.…It does this by deleting the item at the current position.…

Resume Transcript Auto-Scroll

Author

Released

12/13/2013

Design patterns are reusable solutions that solve the challenges software developers face over and over again. Rather than reinventing the wheel, learn how to make use of these proven and tested patterns that will make your software more reliable and flexible to change. This course will introduce you to design patterns and take you through seven of the most used object-oriented patterns that will make your development faster and easier. Elisabeth Robson and Eric Freeman, coauthors of Head First Design Patterns, join forces to provide an overview of each pattern and examples of the pattern in action. Featured design patterns include the strategy, observer, decorator, singleton, collection, state, and factory method patterns.

Topics include:

What are design patterns?

Encapsulating code that varies with the strategy pattern

Setting behavior dynamically

Implementing the observer pattern

Creating chaos with inheritance

Extending behavior with composition

Dealing with multithreading and the singleton pattern

Revising the design for a state machine

Encapsulating iteration with the collection pattern

Encapsulating object creation with the factory method pattern

Skill Level Intermediate

2h 19m

Duration

1,083,612

Views

Show MoreShow Less

Q: How do I import the exercise files in
Eclipse?

A: Here are instructions for importing the files:

1) Save the download folder as any name you choose, such as DesignPatternsLynda. Place this folder in the default Eclipse
project folder (the folder you choose when you start Eclipse).

2) Start Eclipse.

3) In Eclipse, choose File > New > New Java Project.

4) In the first New Project dialog box, use the folder name from step 1 as the
project name. Check that the location path matches the default Eclipse project
path and the name of the folder. (See NewProject.jpg.)

5) Click Next.

6) In this dialog box, leave all settings as is (see Step2.jpg):

7) Click Finish.

8) You should now have a project in Eclipse with the following structure (see EclipseProjectStructure.jpg):

9) To compile the code, open the folder you want to work with and choose the
main class.