Java tutorial
/* Output: [U, C, L] Exception in thread "main" java.lang.IndexOutOfBoundsException: Source does not fit in dest at java.util.Collections.copy(Collections.java:531) at MainClass.main(MainClass.java:21) * */ import java.util.Arrays; import java.util.Collections; import java.util.List; public class MainClass { public static void main(String args[]) throws Exception { List wineMakers = Arrays.asList(new String[] { "U", "C" }); List barFlies = Arrays.asList(new String[] { "U", "C", "L" }); Collections.copy(barFlies, wineMakers); System.out.println(barFlies); Collections.copy(wineMakers, barFlies); } }