title: How to delete a node from a linked list
body: <p>Hey guys I wrote this deleteNode() method that works if I used numbers(int) but doesn't when I try to pass a string in. I'm printing out a String[] list of names and I'm trying to delete a certain name off the list. When I enter a name, it prints "Node not found". Like I said, if I print out a list of numbers it works great but if I change up and print a string it doesnt. Any help is appreciated. </p>
  
  <pre><code>   public class BigNode {
  
  
     public String dataitems; 
      public BigNode next; 
      BigNode front ;
  
      public void initList(){
          front = null;
      }
  
      public BigNode makeNode(String number){
          BigNode newNode;
          newNode = new BigNode();
          newNode.dataitems = number;
          newNode.next = null;
          return newNode;
      }
  
      public boolean isListEmpty(BigNode front){
          boolean balance;
          if (front == null){
              balance = true;
          }
          else {
              balance = false;
          }
          return balance;
  
      }
  
      public BigNode findTail(BigNode front) {
          BigNode current;
          current = front;
          while(current.next != null){
              //System.out.print(current.dataitems);
              current = current.next;
  
          } //System.out.println(current.dataitems);
          return current;
      }
  
      public void addNode(BigNode front ,String number){
          BigNode tail;
          if(isListEmpty(front)){
              this.front = makeNode(number);
          } 
          else {
              tail = findTail(front);
              tail.next = makeNode(number);
          }
      }
      public void deleteNode(BigNode front, String value) {
          BigNode curr, previous = null; boolean found; 
  
              if (!isListEmpty(front)){
                  curr = front;
                  found = false;
  
                  while ((curr.next != null) &amp;&amp; (!found)) {
                      if(curr.dataitems.equals(value)) {
                          found = true;
                      } 
                      else {
                          previous = curr;
                          curr = curr.next;
                      }
                  }
                  if (!found) {
                      if(curr.dataitems.equals(value)) {
                          found = true;
                      }
                  }
                  if (found) {
                      if (curr.dataitems.equals(front.dataitems)){ // front.dataitems may be wrong .dataitems 
                          front = curr.next;
                      } else { 
  
                          previous.next = curr.next;
                      }
                  } else {
                      System.out.println("Node not found!");
                      //curr.next = null; // Not sure If this is needed
                  }
          } 
              showList(front);
      }
  
  
  
  
      public void printNodes(String[] len){
  
  
          int j;
          for (j = 0; j &lt; len.length; j++){
  
              addNode(front, len[j]);
          }  showList(front);
      }
  
      public void showList(BigNode front){
          BigNode current;
          current = front;
          while ( current.next != null){
              System.out.print(current.dataitems + ", ");
              current = current.next;
          }
          System.out.println(current.dataitems);
      }
      public static void main(String[] args) {
                     String[] names = {"Billy Joe", "Sally Mae", "Joe Blow", "Tasha Blue"}; 
  
          BigNode x = new BigNode(); 
                     x.printNodes(names); 
                     Scanner in = new Scanner(System.in);
                     String delete = in.next();
                    x.deleteNode(x.front, delete); 
            }
  </code></pre>
  
  <p>String[] names = {name1, name2, name3, name4} </p>
  
  <p>-First it prints the list, then ask what name to delete. </p>