Java Program to Reverse a List using Data Swapping
class GFG { static class Node { int data ; Node prev , next ; } ; static Node newNode ( int val ) { Node temp = new Node ( ) ; temp . data = val ; temp . prev = temp . next = null ; return temp ; } static void printList ( Node head ) { while ( head . next != null ) { System . out . print ( head . data + " ▁ < - > ▁ " ) ; head = head . next ; } System . out . println ( head . data ) ; }