For this Question: Given a Deque and Q queries. The task is to perform some operation on Deque according to the queries as described in input:

Note:-if deque is empty than pop operation will do nothing, and -1 will be printed as a front and rear element of queue if it is empty.User task:
Since this will be a functional problem, you don't have to take input. You just have to complete the functions:
 <b>push_front_pf()</b>:-  that takes the deque and the integer to be added as a parameter.
 <b>push_bac_pb()</b>:-    that takes the deque and the integer to be added as a parameter.
 <b>pop_back_ppb()</b>:-      that takes the deque as parameter.
 <b>front_dq()</b>:-  that takes the deque as parameter.

Constraints:
1 <= N(Number of queries) <= 10<sup>3</sup>

<b>Custom Input: </b>
First line of input should contain the number of queries Q. Next, Q lines should contain any of the given operations:-
For <b>push_front</b>  use <b> pf x</b> where x is the element to be added
For <b>push_rear</b>  use <b> pb x</b> where x is the element to be added 
For <b>pop_back</b>  use <b> pp_b</b>
For <b>Display Front</b> use <b>f</b>
Moreover driver code will print
Front element of deque in each push_front opertion
Last element of deque in each push_back operation
Size of deque in each pop_back operation The front_dq() function will return the element at front of your deque in a new line, if the deque is empty you just need to return -1 in the function.Sample Input:
6
push_front 2
push_front 3
push_rear 5
display_front
pop_rear
display_front

Sample Output:
3
3, I have written this Solution Code:      
     static void push_back_pb(Deque<Integer> dq, int x)
     {
         dq.add(x);
     }
     static void push_front_pf(Deque<Integer> dq, int x)
     {
         dq.addFirst(x);
     }
     static void pop_back_ppb(Deque<Integer> dq)
     {
         if(!dq.isEmpty())
            dq.pollLast();
        else return;
     }
     static int front_dq(Deque<Integer> dq)
     {
         if(!dq.isEmpty())
            return dq.peek();
        else return -1;
     }
, In this Programming Language: Java, Now tell me if this Code is compilable or not?