src/main/java/com/leetcode/design/medium/DesignLinkedList_707.java
public void addAtTail(int val) {
    if (head == null) {
      head = new Node(val);
      return;
    }

    Node node = head;

    while (node.next != null) {
      node = node.next;
    }

    node.next = new Node(val);
  }
/** Append a node of value val to the last element of the linked list. */
Append a node of value val to the last element of the linked list.
Append a node of value val to the last element of the linked list .
public void addAtTail(int val) {
    if (head == null) {
      head = new Node(val);
      return;
    }
    Node node = head;
    while (node.next != null) {
      node = node.next;
    }
    node.next = new Node(val);
  }
public void addAtTail ( int val ) { if ( head == null ) { head = new Node ( val ) ; return ; } Node node = head ; while ( node . next != null ) { node = node . next ; } node . next = new Node ( val ) ; }
Append a node of value val to the last element of the linked list.
Append a node of value val to the last element of the linked list .