What I'm looking for is some sort of dynamic buffering which I try to explain:
It should be possible to add some values at the end of the buffer. And while it's adding up values at the end of the buffer, I should be able to get some values from the beginning of the buffer.
So like this in pseudocode:
ThreadA
while(true):
buffer.pushToEnd(random);
ThreadB
while(true):
buffer.popFromBeginning();
So the values I'm popping should be removed from the buffer. I'm looking all over the internet and found various buffer types, but none of them is capable of acting this way.
So my question is: Is there some native java implementation of this buffer behavior? Or some example code of the implementation?