Java Queue Implementations
by, 02-19-2012 at 07:02 AM (747 Views)
Collection Interface’s subtype is Queue. In the Queue interface, collection interface methods are present automatically.
Queue interface instance can’t be created. Queue interface concrete implementations are required. In Collections API, the available Queue implementations are as following. Among them, one can make a choice:
LinkedList is a considered to be a standard queue implementation.
Elements are stored internally by PriorityQueue in accordance with their natural order or in accordance in which a Comparator is passed to PriorityQueue.
In java.util.concurrent package, Queue implementations are also present.
How a Queue instance is created is explained in these given examples:
Java Code: This is the code to explain Java Queue ImplementationsQueue queueA = new LinkedList(); Queue queueB = new PriorityQueue();