return an iterable collection of the most accessed elements using sorted list and nested class the first implementation of favorite list that we consider (in code fragments is to build classfavoriteliststoring references to accessed objects in linked list ordered by nonincreasing access counts this class also uses feature of java that allows us to define related class nested inside an enclosing class definition such nested class must be declared staticto indicate that this definition is related to the enclosing classnot any specific instance of that class using nested classes allows us to define "helperor "supportclasses that can be protected from outside use in this casethe nested classentrystoresfor each element in our lista pair ( , )where is the access count for and is value reference to the element itself each time an element is accessedwe find it in the linked list (adding it if it is not already thereand increment its access count removing an element amounts to finding it and taking it out of our linked list returning the most accessed elements simply involves our copying the entry values into an output list according to their order in the internal linked list code fragment class favoriteslist (continues in code fragment