I\'m looking for a implementation of java.util.Queue or something in the Google collection who behave like a Queue, but also ensure that each element of the queue is unique.
Unfortunately it doesn't exist. Since I needed such a Queue I have developed a Blocking Queue backed by a set, inspired by java.util.concurrent.LinkedBlockingQueue.
You can find it here :
https://github.com/bvanalderweireldt/concurrent-unique-queue
Example :
final BlockingQueue queue = new ConcurrentSetBlockingQueue<>(1);
queue.offer(new Integer(1)); //True
queue.offer(new Integer(1)); //False
You can use it with Maven :
com.hybhub
concurrent-util
0.1