I have an array with 1000 items. Every few seconds a new item is stuffed into the array. I only want to keep the last 1000 items.
Is there a way to simply push a new item into the array, allowing the oldest one to fall off? Meaning I would have to shift all of them each time a new item is added. So if we are at 1000 items, then item number 1 gets deleted... number 2 becomes number 1, 3 becomes 2, etc.. all the way to number 1000 which moves to 999 to make room for the new number 1000.
Having asked this, is this the best way to do this?