Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsAddAllExample3 { public static void main(String[] args) { //Create object of an array list List
alist = new ArrayList
(); //Add values to the list alist.add("JavaTpoint"); alist.add("SSSIT.COM"); alist.add("Hindi100.COM"); System.out.println("Initial collection value: "+alist); //Add values to this collection and print Final collection Result boolean b = Collections.addAll(alist, "Rank1","Rank2","Rank3"); System.out.println("Boolean Result: "+b); System.out.println("Final collection value: "+alist); } }
Output