Can anyone show me how I can swap two items in a two-way linked list, by
changing just the references not the data?

I've got an idea but I don't know if this is correct (first points at the
first of the two items to be swapped).

swap(ListIterator first) {
ListNode temp = first;

(first.previous).next =;

first =;
first.previous = temp.previous; = temp;

( = first;

first, next, previous are all ListNode objects.