I know the basic difference between two of them that ConcurrentLinkedDeque can be use in multithreaded application.
Can any one give me practical example how it would affect the performance of application if wrongly used, in which scenario i should go with ConcurrentLinkedDeque and when to use ArrayDeque.
Use
ConcurrentLinkedDeque
if you need synchronized access to your queue from multiple threads,ArrayDeque
if not.Period.
The consequence of using the wrong one is that if you attempt to access an
ArrayDeque
in a multi-thread setting you will corrupt your queue.Period.
That is your only performance consideration. All others are moot.
Unless...
You ran your application through a profiler and discovered most of its time is spent inside of
ConcurrentLinkedDeque.size()
. Then switch toArrayDeque
wrapped insynchronized
blocks.End of lecture ;)