Java Deque addAll() Method

22 Mar 2025 | 2 min read

The addAll() method of Java Deque Interface is used to add all the elements in a specified collection at the end of the deque.

Specified by:

  • addAll in interface Collection<E>

Syntax:

Parameter:

The above method consists of only one parameter:

  1. The element 'c' that needs to be inserted.

Return:

The above method returns true if the given deque is changed.

Example 1

Output:

 The marks for student1 : 28 25 26 The marks for student2 : 22 19 20 The total list for the marks : 28 25 26 22 19 20 

Example 2

Output:

 Enter the name of Employees for List 1: Sam Ram Priya Urvashi Enter the name of Employees for List 2: Ravi Rita Yashika Lavish The final list for the employees is given as : Sam Ram Priya Urvashi Ravi Rita Yashika Lavish 
Next TopicJava Deque