I need a data structure, which is a special type of queue. I want that if an instance of my queue ever contained an object X, in this instance it would not be possible to re-put X in this instance. The enqueuing method should just do nothing if called with X, as an attempt to add a duplicate value to a HashSet.
Usage example:
MyQueue<int> queue = new MyQueue<int>();
queue.Enqueue(5);
queue.Enqueue(17);
queue.Enqueue(28);
queue.Enqueue(17);
int firstNumber = queue.Dequeue();
queue.Enqueue(5);
queue.Enqueue(3);
List<int> queueContents = queue.ToList();
I looked at MSDN but could not find such a class. Does this exist, or should I implement it myself?
, , FIFO, , . , , " ".