Driver program to test above
public static void main ( String [ ] args ) { Deque dq = new Deque ( ) ; System . out . print ( "Insert element '5' at rear endNEW_LINE"); dq . insertRear ( 5 ) ; System . out . print ( "Insert element '10' at rear endNEW_LINE"); dq . insertRear ( 10 ) ; System . out . print ( " Rear ▁ end ▁ element : ▁ " + dq . getRear ( ) + "NEW_LINE"); dq . deleteRear ( ) ; System . out . print ( " After ▁ deleting ▁ rear ▁ element ▁ new ▁ rear " + " ▁ is : ▁ " + dq . getRear ( ) + "NEW_LINE"); System . out . print ( "Inserting element '15' at front end NEW_LINE"); dq . insertFront ( 15 ) ; System . out . print ( " Front ▁ end ▁ element : ▁ " + dq . getFront ( ) + "NEW_LINE"); System . out . print ( " Number ▁ of ▁ elements ▁ in ▁ Deque : ▁ " + dq . size ( ) + "NEW_LINE"); dq . deleteFront ( ) ; System . out . print ( " After ▁ deleting ▁ front ▁ element ▁ new ▁ " + " front ▁ is : ▁ " + dq . getFront ( ) + "NEW_LINE"); } }