[英]Java thread safe concurrent queue with unique elements
I need a data structure that should be a concurrent and unique queue.我需要一个数据结构,它应该是一个并发且唯一的队列。
ConcurrentLinkedQueue
will solve my problem but I need to add unique elements in the queue(FIFO). ConcurrentLinkedQueue
将解决我的问题,但我需要在队列中添加唯一元素(FIFO)。 Do I have to combine both Set
and ConcurrentLinkedQueue
in order to achieve this?我是否必须将
Set
和ConcurrentLinkedQueue
结合起来才能实现这一点?
Have you tried PriorityBlockingQueue ??你试过PriorityBlockingQueue吗?
Also you can take a look at Which concurrent Queue implementation should I use in Java?您还可以看看我应该在 Java 中使用哪个并发队列实现?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.