How can I modify a queue collection in a loop?

前端 未结 3 1080
离开以前
离开以前 2020-12-19 01:49

I have a scenario where I need to remove an item for the queue as soon as been processed. I understand I cannot remove an item from a collection whilst in loop but was wond

3条回答
  •  没有蜡笔的小新
    2020-12-19 01:59

    To me, it looks like you are trying to process the element in queue one-by-one.

    How about wrapping this in while loop and process each element from Dequeue, until the queue is empty?

提交回复
热议问题