AddFirst() Method : Insert element at start ArrayDeque in Java

   

Declaration :

Explanation :

Purpose The java.util.ArrayDeque.addFirst(E e) method inserts the specified element E at the front of the deque.
Parameters e ===> The element to be added in the deque.
Return Value This method does not return any value.
Exception NullPointerException — if the specified element is null.

Java Program : Example

Below example will explain java.util.ArrayDeque.addFirst(E) method.

Output of Program :