Looking for any existing FIFO Queue which also handles overrides based on topic as follows given
struct QueueItem { string Topic; .... other data }
if the queue has items added in the order
q.Add( new QueueItem() { topic = A, ... } ); //1
q.Add( new QueueItem() { topic = B, ... } ); //2
q.Add( new QueueItem() { topic = C, ... } ); //3
q.Add( new QueueItem() { topic = A, ... } ); //4
q.Add( new QueueItem() { topic = B, ... } ); //5
At retrieval the order should be
#4 Topic A – skipping #1
#5 Topic B – skipping #2
#3 Topic C
etc.
NOTE – the order in which the items/Topics are added/processed is important given the rule above
Wondering if this is a known scenario and there might be an existing implementation out there already
What you’re looking for is a priority queue. Your requirement is slightly different in that it uses letters instead of integers for the priority, but the concept is the same. See answers C# Priority Queue and Priority queue in .Net