As the title says, I am looking for a java collection containing only N of the last objects inserted into the collection. This FIFO collection does not require random access or support N.
All collections that I can find are either blocked ( LinkedBlockingQueue ) or unlimited in size ( ArrayDeque ). I found org.eclipse.jetty.util.ArrayQueue, but, as you might have guessed, this brings a rather undesirable dependency on my project, and is also very difficult, since it supports changing N, so it is not what I need.
Do you know if there is a way to get this with a fairly common java library, or do I need to write it myself?
source
share