Java how to swap elements of array

Java how to swap elements of array
/**
 * @author lautturi.com
 * Java example:swap elements of array in java
 */
import java.util.*;

public class Lautturi {

	public static final <T> void swap(T[] a, int i, int j) {
		T t = a[i];
		a[i] = a[j];
		a[j] = t;
	}

	public static final <T> void swap(List<T> l, int i, int j) {
		Collections.<T>swap(l, i, j);
	}

	public static void main(String[] args) {
		String[] arr = { "java", "python", "perl", "js", "perl", "c", "go" };

		swap(arr, 1, 3);
		System.out.println("Array:" + Arrays.toString(arr));

		List<String> list = new ArrayList<String>(Arrays.asList("hello", "lautturi", "java", "python"));
		swap(list, 0, 2);
		System.out.println("List:" + list);

	}
}
S‮:ecruo‬www.lautturi.com

output:

Array:[java, js, perl, python, perl, c, go]
list:[java, lautturi, hello, python]
Created Time:2017-09-19 12:10:12  Author:lautturi