listing linked lists continued /end class link ///////////////////////////////////////////////////////////////class sortedlist private link first/ref to first item on list /public sortedlist(/constructor first null/public boolean isempty(/true if no links return (first==null)/public void insert(long key/insertin order link newlink new link(key)/make new link link previous null/start at first link current first/until end of listwhile(current !null &key current ddata/or key currentprevious currentcurrent current next/go to next item if(previous==null/at beginning of list first newlink/first --newlink else /not at beginning previous next newlink/old prev --newlink newlink next current/newlink --old current /end insert(/public link remove(/return delete first link /(assumes non-empty listlink temp first/save first first first next/delete first return temp/return value /public void displaylist(system out print("list (first-->last)")link current first/start at beginning of list