code: public static <E> void swap(List<E> list1, int list1Index, List<E> list2, int list2Index) {
          if(list1.get(list1Index) != list2.get(list2Index)) {
              E hold = list1.remove(list1Index);            
  
              if(list1 != list2 || list1Index > list2Index){
                  list1.add(list1Index, list2.get(list2Index));
              }
              else {
                  list1.add(list1Index, list2.get(list2Index-1));
              }
              list2.remove(list2Index);
              list2.add(list2Index, hold);                
          }
          
      }
docs: Swap the elements of two lists 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.
  
  @param <E> the type of elements in this list.
  
  @param list1 one of the lists that will have one of its values swapped.
  @param list1Index the index of the first list that will be swapped.
  @param list2 the other list that will have one of its values swapped.
  @param list2Index the index of the second list that will be swapped.