I am trying to find (or write) a Java class that represents a fixed, non-blocking, automatically drops FIFO queue. (for example, if the queue has a capacity of 100, then position 101 deletes element 1, and then successfully adds element 101.) The answer to this question seems useful, but I have an additional limitation - I need it to be fast, for capacities of about 100 -1000.
The elements of my queue are Float only, since is it usually more efficient to use something like AutoDiscardingDeque<Float> described in a related question, or just use float[] manipulations and some System.arraycopy() to process it?
Alternatively, is there an even better solution that I haven't thought about?
source share