momo momo - 1 year ago 258
Java Question

Java, ConcurrentLinkedDeque vs ConcurrentLinkedQueue - the difference?

Api links for ConcurrentLinkedDeque and ConcurrentLinkedQueue:

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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download