class RemoveListDuplicatedElements {

  public void remove2(ListNode<Integer> head) {
    validateInput(head);

    ListNode<Integer> node = head;
    while (node != null) {
      removeNextNodesWithValue(node);
      node = node.getNext();
    }
  }

}