Here is a Java Program to Append all elements of other Collection to Java ArrayList Example
Output of Above Java Program
After appending all elements of Vector, ArrayList contains..
1
2
3
4
5
import java.util.ArrayList; import java.util.Vector; class ArrayListExample { public static void main(String[] args) { ArrayList arrayList = new ArrayList(); arrayList.add("1"); arrayList.add("2"); arrayList.add("3"); Vector v = new Vector(); v.add("4"); v.add("5"); arrayList.addAll(v); System.out.println("After appending all elements of Vector, ArrayList contains.."); for(int i=0; i<arrayList.size(); i++) System.out.println(arrayList.get(i)); } }
Output of Above Java Program
After appending all elements of Vector, ArrayList contains..
1
2
3
4
5