linked lists the list must then provide public methods that allow the iterator to change first these linklist methods are getfirst(and setfirst((the weakness of this approach is that these methods allow anyone to change firstwhich introduces an element of risk here' revised (although still incompleteiterator class that incorporates these additional fieldsalong with reset(and nextlink(methodsclass listiterator(private link currentprivate link previousprivate linklist ourlist/reference to current link /reference to previous link /reference to "parentlist public void reset(/set to start of list current ourlist getfirst()/current --first previous null/previous --null public void nextlink(/go to next link previous current/set previous to this current current next/set this to next 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 listsuch as insertafter()are more naturally performed by the iterator in our example the iterator includes the following methodsreset()--sets the iterator to the start of the list nextlink()--moves the iterator to the next link getcurrent()--returns the link at the iterator atend()--returns true if the iterator is at the end of the list