 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ConcurrentLinkedQueue in Java
The ConcurrentLinkedQueue class in Java is used to implement a queue using a concurrent linked list. 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) {       ConcurrentLinkedQueue<String> clQueue = new ConcurrentLinkedQueue<String>();       clQueue.add("Amy");       clQueue.add("John");       clQueue.add("May");       clQueue.add("Harry");       clQueue.add("Anne");       System.out.println("The elements in ConcurrentLinkedQueue are: " + clQueue);    } } The output of the above program is as follows −
Output
The elements in ConcurrentLinkedQueue are: [Amy, John, May, Harry, Anne]
Now let us understand the above program.
The ConcurrentLinkedQueue is created and then elements are added to it. Finally, it is displayed. A code snippet that demonstrates this is given as follows −
ConcurrentLinkedQueue<String> clQueue = new ConcurrentLinkedQueue<String>(); clQueue.add("Amy"); clQueue.add("John"); clQueue.add("May"); clQueue.add("Harry"); clQueue.add("Anne"); System.out.println("The elements in ConcurrentLinkedQueue are: " + clQueue);Advertisements
 