}//end insertNode() private Node findInsertionPoint(Node temp) { //define Insertion Point as the node after which temp should be inserted Node current = headLastName; if (headLastName.getLastName().CompareTo(temp.getLastName()) > 0) { return(null); } while (current.getLastName().CompareTo(temp.getLastName()) < 0) { if (null == current.nextLastName) { return(current); } else { current = current.nextLastName; } } return(current.prevLastName); }//end findInsertionPoint()
}//end addNode() private Node findNode(String findItem) { Node current = headLastName; while (current.getLastName().CompareTo(findItem) != 0) //names don't match { if (null == current.nextLastName) //reached the end of the list { return(null); //findItem is not in the list } current = current.nextLastName; //found the match } return(current); }//end findNode()
}//end findLastNode() public String showAllNodes() { String nodeList = ""; Node current = headLastName; if (null == headLastName) { return("there are no nodes on this list"); } while (current != null) { nodeList += current.getLastName() + "\n"; current = current.nextLastName; } return(nodeList); }//end showAllNodes