import java.util.Arrays; import java.util.Collections; import java.util.List; public class MainClass { public static void main(String[] a) { List l1 = Arrays.asList(new String[] { "A", "B" ,"C"}); List l2 = Arrays.asList(new String[] { "A", "C", "D" }); Collections.copy(l1, l2); // works Collections.copy(l2, l1); // System.out.println(l1); System.out.println(l2); } }
[A, C, D] [A, C, D]