AbstractCollection addAll() Method in Java with Examples
The addAll(Collection C) method of Java AbstractCollection is used to append all of the elements from a mentioned collection to this collection. The elements are added randomnly without following any specific order.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
boolean addAll(Collection C)
Parameters: The parameter C is a collection of any type that is to be added to the collection.
Return Value: The method returns true if it successfully appends the elements of the collection C to the existing collection otherwise it returns False.
Below programs illustrate the AbstractCollection.addAll() method:
AbstractCollection 1: [4, Geeks, To, TreeSet, Welcome] AbstractCollection 2:  AbstractCollection 2: [4, Geeks, To, TreeSet, Welcome]
AbstractCollection 1: [10, 20, 30, 40, 50] AbstractCollection 2:  AbstractCollection 2: [10, 20, 30, 40, 50]