I need to keep tack of a large amount of data (32k ~ 128k points) and after I reach a certain capacity I need to add new datapoints and discard old ones. The ArrayList class (in the JDK) can insert new elements in constant time at the top of the list (given sufficient capacity), I also would like to have it remove elements in constant time.
I could extend the ArrayList class to do this where it could leave space at the begining of its internal Array when elements are removed. Similiar to how it handles the case when things at the top of the list are removed.... But looking at the ArrayList code extending it to do this would mean rewriting the whole class as this change would affect every single method in there.
before I flesh out this code I'd like to know if there is already is an implementation like this that I can get hold of.
I could extend the ArrayList class to do this where it could leave space at the begining of its internal Array when elements are removed. Similiar to how it handles the case when things at the top of the list are removed.... But looking at the ArrayList code extending it to do this would mean rewriting the whole class as this change would affect every single method in there.
before I flesh out this code I'd like to know if there is already is an implementation like this that I can get hold of.