example we'll show the complete listing for the doublylinked java program soonbut first let' examine some of the methods in its doublylinkedlist class traversal two display methods demonstrate traversal of doubly linked list the displayforward(method is the same as the displaylist(method we've seen in ordinary linked lists the displaybackward(method is similarbut starts at the last element in the list and proceeds toward the start of the listgoing to each element' previous field this code fragment shows how this workslink current lastwhile(current !nullcurrent current previous/start at end /until start of list/move to previous link incidentallysome people take the view thatbecause you can go either way equally easily on doubly linked listthere is no preferred direction and therefore terms like previous and next are inappropriate if you preferyou can substitute direction-neutral terms such as left and right figure insertion at the beginning insertion we've included several insertion routines in the doublylinkedlist class the insertfirst(method inserts at the beginning of the listinsertlast(inserts at the endand insertafter(inserts following an element with specified key unless the list is emptythe insertfirst(routine changes the previous field in the old first link to point to the new linkand changes the next field in the new link to point to the old first link finally it sets first to point to the new link this is shown in figure if the list is emptythen the last field must be changed instead of the first previous field here' the codeifisempty(/if empty list