This program helps us in how to develop Double Linked list
class DoubleMain { public static void main(String[] args) { DoubleLink obj=new DoubleLink(); obj.insert(4); obj.insert(5); obj.insert(6); obj.insert(7); obj.front(); System.out.println("FRONT DIRECTION "); obj.insertAtFirst(8); obj.front(); System.out.println("BACK DIRECTION "); obj.back(); } } class DoubleLink { Node head=null,prev=null,curr=null; void insert(int item) { Node data=new Node(item); if(head==null) { head=data; curr=head; prev=head; } else { curr.next=data; curr=data; data.previous=prev; prev=data; } } public void front() { curr=head; while(curr!=null) { System.out.println(curr.data); curr=curr.next; } } public void back() { curr=prev; while(curr!=null) { System.out.println(curr.data); curr=curr.previous; } } public void insertAtFirst(int item) { Node data=new Node(item); data.next=head; head.previous=data; head=data; } }