1: // Version 4.0 2: // Finds the node that is before the node that should or does 3: // contain a given entry. 4: // Returns either a reference to the node that is before the node 5: // that does or should contain anEntry, or null if no prior node exists 6: // (that is, if anEntry is or belongs at the beginning of the list). 7: private Node getNodeBefore(T anEntry) 8: { 9: Node currentNode = firstNode; 10: Node nodeBefore = null; 11: 12: while ( (currentNode != null) && 13: (anEntry.compareTo(currentNode.getData()) > 0) ) 14: { 15: nodeBefore = currentNode; 16: currentNode = currentNode.getNextNode(); 17: } // end while 18: 19: return nodeBefore; 20: } // end getNodeBefore