Java Deque Implementations
by, 02-19-2012 at 07:07 AM (1200 Views)
Collection interface subtype is DeQue interface. In DeQue interface, all of the Collection interface methods are present.
DeQue interface instance can be created. This interface’s concrete implementation is required to do so. In Collections API, these DeQue implementations are present. Among them, you may select to use.
LinkedList is considered to be a pretty queue implementation.
In an array, elements are stored internally in ArrayDeQue. If elements number get exceeded as compared to the array space, an allocation of a new space is done and elements get moved over. We can say that ArrayQueue will be growing as per requirement even when its elements are stored in an array.
In Java.util.concurrent package, Queue implementations are present.
How a DeQue instance is created is shown in the given examples.
Java Code: This is the code to present DequeDeque dequeA = new LinkedList(); Deque dequeB = new ArrayDeque();