Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
