- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ConcurrentLinkedDeque in Java
The ConcurrentLinkedDeque Class in Java implements a deque and used a concurrent linked list for help. This class implements the Collection interface as well as the AbstractCollection class. It is a part of the Java Collection Framework.
A program that demonstrates this is given as follows −
Example
import java.util.concurrent.*; public class Demo { public static void main(String[] args) { ConcurrentLinkedDeque<String> clDeque = new ConcurrentLinkedDeque<String>(); clDeque.add("James"); clDeque.add("May"); clDeque.add("John"); clDeque.add("Sara"); clDeque.add("Anne"); System.out.println("The elements in ConcurrentLinkedDeque are: " + clDeque); } }
The output of the above program is as follows −
Output
The elements in ConcurrentLinkedDeque are: [James, May, John, Sara, Anne]
Now let us understand the above program.
The ConcurrentLinkedDeque is created and then elements are added to the front of the Deque. Finally, the elements are displayed. A code snippet that demonstrates this is given as follows −
ConcurrentLinkedDeque<String> clDeque = new ConcurrentLinkedDeque<String>(); clDeque.add("James"); clDeque.add("May"); clDeque.add("John"); clDeque.add("Sara"); clDeque.add("Anne"); System.out.println("The elements in ConcurrentLinkedDeque are: " + clDeque);
Advertisements
To Continue Learning Please Login
Login with Google