A fast queue in Java

java, queue

Solution

I see that LinkedList implements the Queue interface, but it will only be as fast as a LinkedList right?

Eyeballing the source code, LinkedList is O(1) for Queue.add, Queue.poll, and Queue.peek operations.

I hope that's fast enough.

Problem

I am looking for a fast `queue` implementation in Java. I see that `LinkedList` implements the `Queue` interface, but it will only be as fast as a `LinkedList` right? Is there a way to have a queue that will be faster especially for `add` (I only need `poll`, `add` and check for `empty`). Down the line I may also need a `PriorityQueue` but not yet.

Original source