code: public static <E> void swap(List<E> list1, List<E> list2) {     
          int minLength = Math.min(list1.size(), list2.size());
          
          for(int i = 0; i < minLength; i++) {
              TrivialSwap.swap(list1, list2, i);
          }
      }
docs: Helper method that swaps all the elements of the arrays. The run time of this method
  depends on the implementation of the lists since elements are removed and added in the
  lists. It also depends on the length of the shortest list.
  
  @param <E> the type of elements in this list.
  
  @param list1 one array that will have its values swapped.
  @param list2 the other array that will have its values swapped.