Home » Java Deque addAll() Method with Examples

Java Deque addAll() Method with Examples

by Online Tutorials Library

Java Deque addAll() Method

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

Test it Now

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

You may also like