View RSS Feed

Algorithm and Data Structure

Java Deque Implementations

Rate this Entry
by , 02-19-2012 at 08:07 AM (1384 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.

  • java.util.LinkedList
  • java.util.ArrayDeque

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 Deque
Deque dequeA = new LinkedList();
Deque dequeB = new ArrayDeque();

Submit "Java Deque Implementations" to Facebook Submit "Java Deque Implementations" to Digg Submit "Java Deque Implementations" to Submit "Java Deque Implementations" to StumbleUpon Submit "Java Deque Implementations" to Google

Tags: java deque Add / Edit Tags