Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started