title: remove duplicates in singly linked list retaining order
body: <p>So I have an abstract data type of a singly linked list, and my compiler is stuck when running this part of the test code.</p>
  
  <pre><code>    test.removeDuplicates();
      System.out.println("removeDuplicates() has been run, check following output for counts of 3");
      test.print();
  </code></pre>
  
  <p>My method for removing duplicates from the given list is as below</p>
  
  <pre><code>public void removeDuplicates() 
  {
      if (head == null) return;
  
      Node iter = head;
  
      while (iter != null) 
      {
          Node currNode = iter;
          while(currNode  != null &amp;&amp; currNode.next != null)
          {
                  if(iter.value == currNode.next.value)
                  {
                      currNode.next = currNode.next.next;
                      nItem--;
                  }
          currNode = currNode.next;
          }
      }
  }
  </code></pre>
  
  <p>I thought this while while loop was looping through the whole list and taking duplicate values out by making pointers skip values to remove them.</p>
  
  <p>apparently one of the while loops does not terminate, it seems my last value isn't getting a pointer to null, but I do not understand why.</p>