Skip to content

jruaux/concurrent-unique-queue

 
 

Repository files navigation

concurrent-unique-queue

A Java concurrent unique queue backed by a Set (LinkedHashSet), for when you need to have a Queue with unique elements. The ConcurrentSetBlockingQueue will behave the same way if the queue is full or if a duplicate entry already exists in the Queue.

Your element needs to have a proper hash and equals implementations !

<dependency>
  <groupId>com.hybhub</groupId>
  <artifactId>concurrent-util</artifactId>
  <version>0.3.0</version>
</dependency>

Usage

#ConcurrentSetBlockingQueue implements BlockingQueue
BlockingQueue<Integer> queue = new ConcurrentSetBlockingQueue<>();

queue.offer(1); # True
queue.offer(2); # True
queue.offer(2); # False

About

Java Concurrent Unique Queue

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%