[英]Java, ConcurrentLinkedDeque vs ConcurrentLinkedQueue - the difference?
Api links for ConcurrentLinkedDeque and ConcurrentLinkedQueue : ConcurrentLinkedDeque和ConcurrentLinkedQueue的 Api链接:
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentLinkedDeque.html 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 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? 第一个,DeQueue有更多的方法,但两者之间的根本区别是什么?
Both collections are thread-safe. 两个集合都是线程安全的。 The difference is that a
ConcurrentLinkedDeque
implements a Deque
, which supports addition and removal of elements at both ends (eg 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. 不同之处在于
ConcurrentLinkedDeque
实现了Deque
,它支持在两端添加和删除元素(例如addFirst
和addLast
),而ConcurrentLinkedQueue
实现了一个Queue
,允许在一端插入称为队列的尾部并在另一端删除,称为队列的头部。
Dequeue allows insertions & deletions from both the ends of the queue that is why there are many methods. Dequeue允许从队列的两端插入和删除,这就是为什么有很多方法。
While queue does not. 虽然队列没有。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.