Here you can find the source of swap(List list, int i, int j)
Parameter | Description |
---|---|
list | the list to perform the swap in |
i | the first position to swap |
j | the second position to swap |
public static void swap(List list, int i, int j)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**/*from ww w. j a v a 2 s . c om*/ * Swaps the values in the list at the given positions * @param list the list to perform the swap in * @param i the first position to swap * @param j the second position to swap */ public static void swap(List list, int i, int j) { Object tmp = list.get(i); list.set(i, list.get(j)); list.set(j, tmp); } }