I know that ArrayDeque is fast when adding and removing simple lists. I tested it, it was quicker to add and delete than LinkedList. Because I know that it is implemented as an Array, so why not Random Access?
I read the ArrayDeque.java file in the Java src. But I do not understand it well with my English level. I've seen a lot of articles from Google and Stack Overflow, but I did not get the answers I wanted.
In conclusion, what I'm looking for is:
- Why is ArrayDeque not Random Access? (I am most curious)
- In what situations is ArrayDeque used?
- Is ArrayDeque not implemented as an Array? (Did I misunderstand this?)
Thank you very much for your reply!
ArrayDequeto implement theListinterface (or just to implement someList-related methods), but I'm not sure if it's being discussed actively: markmail.org/message/…Deque) rather than the implementation? As for performance,ArrayDequeis faster at some operations whileLinkedListis faster at others.... andConcurrentLinkedDequeis the only one that's thread-safe out of the box.