package com.logicbig.example.collections;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class SwapExample {
public static void main(String... args) {
List<String> list = Arrays.asList("one", "two", "three", "four");
System.out.println(list);
Collections.swap(list, 1, 3);
System.out.println(list);
}
}
Output
[one, two, three, four]
[one, four, three, two]