How to create Deque using ArrayDeque class?
This example show you how to create a
Deque using the
ArrayDeque implementation. The
ArrayDeque stores its elements using an array. If the number of elements exceeds the space in the array, a new array will be allocated, and all elements moved the the new allocated array.
In the code below we initiate the size of the
Deque to store five elements. When we add the element number six the array that stores the elements of the
Deque will be resized.