title: Why isn't my method removeDuplicates() returning a Linked List without the duplicates?
body: <p>When I try to implement a method to remove duplicates, it returns the linked list with the duplicates still in.  I'm not sure if it is a problem of variable assignment or potentially the show() method that I have created.</p>
  
  <p><a href="https://www.dropbox.com/s/2cjj4nb4v8i5fg9/RemoveDuplicates.zip?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/2cjj4nb4v8i5fg9/RemoveDuplicates.zip?dl=0</a></p>
  
  <pre><code>public class LinkedList {
      LinkedListNode head;
  
      //generating add method to 
      public void add(int data) {
          LinkedListNode newNode = new LinkedListNode();
          newNode.data = data;
          newNode.next = null;
  
          if (head == null) {
              head = newNode;
          }
          else {
              LinkedListNode current = head;
              while(current.next != null) {
                  current = current.next;
              }
              current.next = newNode;
          }
      }
      public void show() {
          LinkedListNode newNode = head;
  
          while(newNode.next != null) {
              System.out.println(newNode.data);
              newNode = newNode.next;
          }
          System.out.println(newNode.data);
  
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>public class Test {
  
  
      public static void main(String[] args) {
          LinkedListNode head = new LinkedListNode();
  
          //12 and 5 are duplicates
          LinkedList list = new LinkedList();
          list.add(5);
          list.add(45);
          list.add(12);
          list.add(12);
          list.add(5);
          list.add(33);
          list.add(12);
          list.add(45);
  
          list.show();
  
          removeDuplicates(head);
  
          list.show();
      }
  
      public static void removeDuplicates(LinkedListNode head) {
  
          LinkedListNode current = head;
          LinkedListNode runner = null;
  
  
          while (current != null) {
              runner = current;
              while (runner.next != null) {
                  if (runner.next.data == current.data) {
                      runner.next = runner.next.next;
                  }
                  else {
                      runner = runner.next;
                  }
  
              }
              current = current.next;
  
          }
  
      }
  }
  </code></pre>