public void swap(int i,int j){
  x.assertTrue(i < list.size());
  x.assertTrue(j < list.size());
  list.set(i,list.set(j,list.get(i)));
}

public void swap ( int i , int j ) { x . assertTrue ( i < list . size ( ) ) ; x . assertTrue ( j < list . size ( ) ) ; list . set ( i , list . set ( j , list . get ( i ) ) ) ; }
swaps in place the elements at the specified positions in the specified list . ( if the specified positions are equal , invoking this method leaves the list unchanged . )
