Im not really shure about the Class Type "List", as the
standard Java List does not have previous and next, so
I suppose its a new class.
a.next = b.next;
a.previous = b.previous;
b.next = temp.next;//whatever is in temp was changed
//already by a.next = b.next; ! , as temp and a point to the same object
b.previous = temp.previous;
How about that code,
you just cross copy the objects (now matter what they are, or
if they are null)
private void swap(List a, List b)
{
Object aNext= a.next;
Object aPrevious= a.previous;
a.next = b.next;
a.previous = b.previous;
b.next = aNext;
b.previous = aPrevious;
}
//I think you need to parse it also
//Givent that next and previous are of the class type "list"
//do like b.next = (List)aNext; etc.