Here you can find the source of swap(final L list1, final L list2, final int index)
public static <E, L extends List<E>> void swap(final L list1, final L list2, final int index)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <E, L extends List<E>> void swap(final L list1, final L list2, final int index) { final E temp = list1.get(index); list1.set(index, list2.get(index)); list2.set(index, temp);/*w w w .ja v a 2s. c o m*/ } public static <E, L extends List<E>> void swap(final L list1, final L list2, final int start, final int end) { for (int i = start; i < end; i++) { swap(list1, list2, i); } } }