another answer is very right! I provide another way to explain. well, I also confuse the term "unrelated and related." you can look at the source code.
/** The queued items */ final Object[] items; /** items index for next take, poll, peek or remove */ int takeIndex; /** items index for next put, offer, or add */ int putIndex; /** Number of elements in the queue */ int count;
from the source code, we can see that the array is final, so we can not change the size of the array. if we use LinkedBlockingQueue, we can always add more elements ... and in the source code the following link is not final. NOTE. Theoretically, LinkedBlockingQueue is not unlimited. because it can only store MAX_INTEGER minus 8 elements. from javadoc unlimited queue - PriorityBlockingQueue. but PriorityBlockingQueue can also only store MAX_INTEGER -8 elements. so I think there is no perfect unlimited lineup ...
source share