title: Deleting from a Linked List
body: <p>I am writing a program to be a dictionary. In the program you can add and delete words, and print the current and deleted words. My problem is in my delete method, apparently it is deleting words properly but it is not making a linked list storing those deleted word to then print them. Therefore, it only prints the last word i deleted instead of all the words i've deleted. Here is the method:</p>
  
  <pre><code>public void delete(String b) 
  {
      WordMeaningNode current = this.list;
      WordMeaningNode previous = null;
      WordMeaningNode temp;
  
      //While list is empty, return.
      if (this.list == null) 
      {
          return;
      }
  
      // While it is not empty..
      while (current != null) 
      {
          if (current.word.getWord().equalsIgnoreCase(b))
          {
              if (current == this.list)
              {
  
                  this.list = this.list.next;
              } 
              else 
              {
  
                  previous.next = current.next;
              }
  
              temp = current;
              del = temp;
              current.next = null;
              return;
          }
  
          previous = current;
          current = current.next;
      }
  }
  </code></pre>
  
  <p>Can anybody see where my mistake is?</p>