I am trying to find (or write) a Java class that represents a fixed-size, non-blocking, auto-discarding FIFO queue. (e.g. if the queue has a capacity of 100, putting item 101 removes item 1 then successfully appends item 101.) The answer to this question seems helpful, but I have an extra constraint - I need it to be fast, for capacities of around 100-1000.
The items in my queue are only Floats, so is it generally more efficient to use something like the AutoDiscardingDeque<Float>
described in the linked question, or just to use a float[]
and some System.arraycopy()
manipulation to handle it?
Alternatively, is there an even better solution that I haven't thought of?