Other objects can traverse an array list by invoking the


Question: Other objects can traverse an Array List by invoking the list's iterator method, which returns an Iterator. Such an Iterator is used quite a few times in the Drawing class and in the Group Figure class in the drawer6 package. Clean up this code by providing an internal iterator. That is, do the following:

a. Create a Figure Command interface with one method: public void execute (Figure f).

b. Create a Figure List class with a map (Figure Command c) method that calls execute (f) for all fi gures f in the list. This map method is an internal iterator.

c. Change the type of the children field of the Group Figure class to Figure List, and similarly change the type of the figures field of the Drawing class to Figure List.

d. Then replace as many of the external iterator loops in all drawer6 classes as you can with a call to the internal iterator of the Figure List class.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Other objects can traverse an array list by invoking the
Reference No:- TGS02580370

Expected delivery within 24 Hours