Why I think ArrayBlockingQueue implementation doesn't make sense -
- A queue always adds at the end and removes from the front. Which means a linked list would be the most efficient data-structure to implement it.
- Queue items are never accessed using index so it defeats the purpose of having an indexed data-structure
- Arrays are always pre-allocated and difficult structures to increase/decrease in size
- Arrays require contiguous memory allocation which is not the use case of queues, it might trigger compaction cycle of GC to de-fragment heap
- Removal of the first element of an array would mean re-ordering rest of the indices, which is the most frequent use case of a Queue. Why to take this overhead ?
Does someone think otherwise ?