import java.util.ArrayList;
import java.util.Collections;
public class UsefulCodes {
//Collections and addAll() Method
public static void collection(){
String[] stuff = {"chocolate", "pizza","bread","rice"};
ArrayList<String> list = new ArrayList<String>();
list.add("youtube");
list.add("google");
list.add("outlook");
System.out.printf("Collection = ");
for(String z : list)
System.out.printf("%s ",z);
// Add all elements from stuff to List2
Collections.addAll(list,stuff);
System.out.printf("\nNew Collection = ");
for(String z : list)
System.out.printf("%s ",z);
}
// Main Method
public static void main(String[] args) {
collection();
}
}