@Test public void shouldNotModifyListIfThereAreNotDuplicatedElements2() { ListNode<Integer> head = createList(new Integer[] { 0, 1, 2, 3, 4 }); removeDuplicates.remove2(head); assertListContainsElements(new Integer[] { 0, 1, 2, 3, 4 }, head); }
public void remove2(ListNode<Integer> head) { validateInput(head); ListNode<Integer> node = head; while (node != null) { removeNextNodesWithValue(node); node = node.getNext(); } }
RemoveListDuplicatedElements { public void remove2(ListNode<Integer> head) { validateInput(head); ListNode<Integer> node = head; while (node != null) { removeNextNodesWithValue(node); node = node.getNext(); } } }
RemoveListDuplicatedElements { public void remove2(ListNode<Integer> head) { validateInput(head); ListNode<Integer> node = head; while (node != null) { removeNextNodesWithValue(node); node = node.getNext(); } }  }
RemoveListDuplicatedElements { public void remove2(ListNode<Integer> head) { validateInput(head); ListNode<Integer> node = head; while (node != null) { removeNextNodesWithValue(node); node = node.getNext(); } }  void remove(ListNode<Integer> head); void remove2(ListNode<Integer> head); }
RemoveListDuplicatedElements { public void remove2(ListNode<Integer> head) { validateInput(head); ListNode<Integer> node = head; while (node != null) { removeNextNodesWithValue(node); node = node.getNext(); } }  void remove(ListNode<Integer> head); void remove2(ListNode<Integer> head);  }