public void insertBefore(HTreeNode nodeAfter, HTreeNode nodeBefore){
    
    /* Check if any of the nodes are null. */
    if (nodeAfter == null || nodeBefore == null || getHeadNode() == null)
      return;
    
    /* Checks if nodeAfter is head, if so, nodeBefore is inserted as new head. */
    if (getHeadNode().equals(nodeAfter)){
      
      /* Set nodeBefore as head. */
      nodeBefore.setNext(nodeAfter);
      setHead(nodeBefore);
      
      /* Increment length of linked list. */
      this.length++;
      return;
    }
    
    /* Node for iteration. */
    HTreeNode node;
    
    /* Finds node in list before nodeAfter, then inserts new node before nodeAfter in list. */
    for (node = getHeadNode(); node.next() != null; node = node.next()) {
      
      /* Checks if next node is nodeAfter, if so, inserts nodeBefore before nodeAfter in list. */
      if(node.next().equals(nodeAfter)){
        
        /* Insert nodeBefore before nodeAfter. */
        nodeBefore.setNext(node.next());
        node.setNext(nodeBefore);
        
        /* Increment length of linked list. */
        this.length++;
        return;
      }
      
    }
    
  }