public static < E > void swap ( List < E > list , int index1 , int index2 ) { TrivialSwap . swap ( list , index1 , list , index2 ) ; }
Swap two elements of a list at the specified positions . The run time of this method depends on the implementation of the lists since elements are removed and added in the lists .