I have a list of items I am adding to, however this special list will delete anything past a given capacity. Note the order is maintained.
For the life of me, I can't think of the name of such a construct.
Consider
data = new SpecialListType(3); // set capacity to 3
data.Add("A");
data.Add("B");
data.Add("C");
data.Add("D");
data.Dump(); // returns {"B", "C", "D"}
What is this? Some form of a Set
or Buffer
? And is there a framework implementation of this in Java and .NET?
core.async
has a channel with the same semantics that they call a "sliding buffer" which I think is a good name. There is also a "dropping buffer" channel which would have not put "D" into the list and kept "A" in.