Java, ConcurrentLinkedDeque vs ConcurrentLinkedQueue - difference?

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?

First, DeQueue has a lot more methods, but what is the fundamental difference between the two?

+6
source share
2 answers

Both collections are thread safe. The difference is that a ConcurrentLinkedDeque implements Deque , which supports adding and removing elements from both ends (e.g. addFirst and addLast ), while ConcurrentLinkedQueue implements Queue , which allows you to insert at one end, called the tail of the queue, and delete at the other end, called the head of the queue.

+15
source

Dequeue allows inserts and deletes from both ends of the queue, so there are many methods.

While the queue is not working.

+1
source

Source: https://habr.com/ru/post/981761/


All Articles