1public class ArrayListExample
2{
3 public static void main(String[] args)
4 {
5 ArrayList<String> list = new ArrayList<>(Arrays.asList("a", "b", "c", "d", "e", "f"));
6
7 System.out.println(list);
8
9 Collections.swap(list, 1, 2);
10
11 System.out.println(list);
12 }
13}
14