I have a use-case where I am processing locations to use for event validation. This is a multi-threaded environment, so I'd like to use a thread safe queue data structure of some sort.
ConcurrentLinkedQueue does almost exactly what I want, but there is no way to specific the max size of the queue. I'd like to only be able to fit N elements in the queue, and then throw the "oldest" one away (FIFO for example) if adding an element would exceed the size of the queue.
LinkedBlockingQueue seems similar to what I want, but I DO NOT want the blocking behavior when the queue is full - I just want the oldest value to be evicted and the new value inserted.
Is there a default implementation of this that I could leverage? Or would it involve a custom implementation of a doubly linked list for example?