we might notefor you old-time +programmersthat in +the connection between the iterator and the list is typically provided by making the iterator class friend of the list class howeverjava has no friend classeswhich are controversial in any case because they are chink in the armor of data hiding iterator methods additional methods can make the iterator flexible and powerful class all operations previously performed by the class that involve iterating through the listlike insertafter()are more naturally performed by the iterator in our example the iterator includes the following methodsreset(sets iterator to the start of the list nextlink(moves iterator to next link getcurrent(returns the link at iterator tend(returns true if iterator is at end of list insertafter(inserts new link after iterator insertbefore(inserts new link before iterator deletecurrent(deletes the link at the iterator the user can position the iterator using reset(and nextlink()check if it' at the end of the list with atend()and perform the other operations shown deciding which tasks should be carried out by an iterator and which by the list itself is not always easy an insertbefore(method works best in the iteratorbut an insertfirst(routine that always inserts at the beginning of the list might be more appropriate in the list class we've kept displaylist(routine in the listbut this operation could also be handled with getcurrent(and nextlink(calls to the iterator the interiterator java program the interiterator java program includes an interactive interface that permits the user to control the iterator directly once you've started the programyou can perform the following actions by typing the appropriate letters show the list contents reset the iterator to the start of the list go to the next link get the contents of the current link insert before the current link