Define a function swap_ends that consumes a list of integers and modifies the list so that the first and last elements are swapped, returning the original list. If the list is empty, return the empty list.