Reputation: 22369
Api links for ConcurrentLinkedDeque and ConcurrentLinkedQueue:
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentLinkedDeque.html
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html
What is the difference between the two?
The first one, DeQueue has a lot more methods, but what is the fundamental difference between the two?
Upvotes: 13
Views: 6898
Reputation: 72874
Both collections are thread-safe. The difference is that a ConcurrentLinkedDeque
implements a Deque
, which supports addition and removal of elements at both ends (e.g. addFirst
and addLast
), whereas ConcurrentLinkedQueue
implements a Queue
which allows insertion at one end called the tail of the queue and removal at the other end, called the head of the queue.
Upvotes: 28
Reputation: 197
Dequeue allows insertions & deletions from both the ends of the queue that is why there are many methods.
While queue does not.
Upvotes: 3