4-Linked Lists/07. Linked List Problems_/JavaLinkedListDataStructures/JavaLinkedListDataStructures/LinkedList.java
public void reverseList() {
        if(head == null || head.getNext() == null) {
            return;
        }

        Node<T> prev = null;
        Node<T> curr = head;
        while (curr != null) {
            Node<T> next = curr.getNext();
            curr.setNext(prev);
            prev = curr;
            curr = next;
        }

        head = prev;
    }
/**
     * Reverse all the nodes in the linked list so that the last node
     * becomes the first node.
     */
Reverse all the nodes in the linked list so that the last node
becomes the first node.
Reverse all the nodes in the linked list so that the last node becomes the first node .
public void reverseList() {
        if(head == null || head.getNext() == null) {
            return;
        }
        Node<T> prev = null;
        Node<T> curr = head;
        while (curr != null) {
            Node<T> next = curr.getNext();
            curr.setNext(prev);
            prev = curr;
            curr = next;
        }
        head = prev;
    }
public void reverseList ( ) { if ( head == null || head . getNext ( ) == null ) { return ; } Node < T > prev = null ; Node < T > curr = head ; while ( curr != null ) { Node < T > next = curr . getNext ( ) ; curr . setNext ( prev ) ; prev = curr ; curr = next ; } head = prev ; }
Reverse all the nodes in the linked list so that the last node
 becomes the first node.
Reverse all the nodes in the linked list so that the last node becomes the first node .