The addAll(int index, Collection C) method of AbstractSequentialList is used to append all of the elements from the collection passed as a parameter to this function at a specific index or position of a abstract sequential list.
boolean addAll(int index, Collection C)
Parameters: This function accepts two parameters as shown in the above syntax and are described below.
- index: This parameter is of integer datatype and specifies the position in the list starting from where the elements from the container will be inserted.
- C: It is a collection whose elements are needed to be appended.
Return Value: The method returns TRUE if at least one action of append is performed.
Below programs illustrate the Java.util.AbstractSequentialList.addAll() method:
AbstractSequentialList: [Geeks, for, Geeks, 10, 20] The new list is: [Geeks, A, Computer, Portal, for, Geeks, for, Geeks, 10, 20]
The AbstractSequentialList is: [10, 20, 30, 10, 20] The new list is: [10, 1, 2, 3, 4, 5, 20, 30, 10, 20]
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.