I am trying to do the merge Two sorted Double LinkedLists and here is what I got so far correct me if I am wrong

public static ListNode mergeSortedDoubleLinkedList(ListNode L1,ListNode L2){

ListNode dummyHead=new ListNode(0,null,null);

ListNode current=dummyHead,p1=L1,p2=L2;

while(p1!=null || p2!=null){

if(p1.data<p2.data){

current.next=p1;

current.prev=p1.prev;

p1=p1.next;

p1.prev=current;

}

else

{

current.next=p2;

current.prev=p2.prev;

p2=p2.next;

p2.prev=current;

}

current.prev=current;

current=current.next;

}

current.next=p1!=null?p1:p2;

return dummyHead.next;

}