In your code example, the syntax is wrong, but I think you've got a good basic idea of how to do the switch.
If the implementation of this swap operation had access to the necessary parts of the list, I'd likely leave the structure of the list in tack, get the data from the head node, get the data from the tail node, put the old head data in the tail node, put the old tail data in the head node,
test it and call it done.
So, can you write the code to do the first part, get the data from the head node of the list?
(Note that if you don't have adequate access to the internal parts of the list, then you may have to completely deconstruct it and build a new one, depending on just what methods are available. Hopefully this can be avoided.)