class ReverseLinkedList {

  public ListNode reverseIterative(ListNode list) {
    validateInput(list);

    if (list.getNext() == null) {
      return list;
    }

    ListNode head = null;
    ListNode current = list;
    while (current != null) {
      ListNode save = current;
      current = current.getNext();
      save.setNext(head);
      head = save;
    }
    return head;
  }

}