Question: How do I implement these methods, like the peek() method, using previously implemented functions such as public Character dequeue and public void enqueue and others?

How do I implement these methods, like the peek() method, using previously implemented functions such as public Character dequeue and public void enqueue and others?

Add the following methods to your IDeque interface. All of these methods

Add the following methods to your IDeque interface. All of these methods are secondary and should be implemented as default methods inside the interface. Include all contracts and Javadoc comments for these methods. a. Character peek () - returns the character at the front of the deque but does not remove it from the deque (final state of the deque is equivalent to the deque's initial state, the deque can change during the method). b. Character endOfDeque () - does not remove it from the deque. returns the character at the end of the deque but C. void insert (Character c, int pos) inserts c at position pos in the deque. Pos index starts at 1, so the item at the very front of the deque is pos 1. d. Character remove (int pos). removes whatever character was in position pos in the deque and returns it. Pos index starts at 1, so the item at the very front of the deque is pos 1. e. Character get (int pos) returns whatever character was in position pos in the deque and without removing it. Pos index starts at 1, so the item at the very front of the deque is pos 1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!