Question
Implement a method public boolean add(int i, T s) that adds an element with an element of type T at index i. (Note that this
Implement a method public boolean add(int i, T s) that adds an element with an element of type T at index i. (Note that this uses Javas overload facility since we already have an add method with just a String argument.) Return false if there is not already an element at index i in the list, otherwise add the element and return true. (Note that this doesnt let you add a new element to the very end but the existing add method accomplishes this.) The elements before index i should be unchanged. Your new element will be placed at index i. The elements which were already at index i and after should all be in the same order but moved down (at one index value greater than they were before the call to your add method). This is a doubly linked list.
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