linked lists in insertfirst(we begin by creating the new link using the data passed as arguments then we change the link references as we just noted/insert at start of list public void insertfirst(int iddouble dd/make new link link newlink new link(iddd)newlink next first/newlink --old first first newlink/first --newlink the --arrows in the comments in the last two statements mean that link (or the first fieldconnects to the next (downstreamlink (in doubly linked lists we'll see upstream connections as wellsymbolized by <-arrows compare these two statements with figure make sure you understand how the statements cause the links to be changedas shown in the figure this kind of reference manipulation is the heart of linked-list algorithms the deletefirst(method the deletefirst(method is the reverse of insertfirst(it disconnects the first link by rerouting first to point to the second link this second link is found by looking at the next field in the first linkpublic link deletefirst(link temp firstfirst first nextreturn temp/delete first item /(assumes list not empty/save reference to link /delete itfirst-->old next /return deleted link the second statement is all you need to remove the first link from the list we choose to also return the linkfor the convenience of the user of the linked listso we save it in temp before deleting it and return the value of temp figure shows how first is rerouted to delete the object in +and similar languagesyou would need to worry about deleting the link itself after it was disconnected from the list it' in memory somewherebut now nothing refers to it what will become of itin javathe garbage collection process will destroy it at some point in the futureit' not your responsibility notice that the deletefirst(method assumes the list is not empty before calling ityour program should verify this fact with the isempty(method