How to return elements of ArrayDeque as array in Java ?


Declaration :

Explanation :

Purpose The java.util.ArrayDeque.toArray() method returns an array containing all of the elements in this deque in proper sequence.
Parameters NA
Return Value This method returns an array containing all of the elements in this deque.
Exception NA

Java Program : Example

Below example will explain java.util.ArrayDeque.toArray() method.

Output of Program :