Android examples for java.util:List Element
swap element in a List
//package com.java2s; import java.util.List; public class Main { public static void swap(List<?> list, int i, int j) { final List l = list; l.set(i, l.set(j, l.get(i)));//from www. java 2 s .c om } private static void swap(Object[] arr, int i, int j) { Object tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; } }