Question: Question # 0 1 : Create a generic class called MyArrayList that includes the following instance methods: 1 . add ( index , value )

Question #01: Create a generic class called MyArrayList that includes the following instance methods:
1. add(index, value)-inserts given value just before the given index, shifting subsequent values to the right
2. indexOf(value)-returns first index where given value is found in list (-1 if not found)
3. remove(index)-removes/returns value at given index, shifting subsequent values to the left
4. set(index, value)-replaces value at given index with given value
5. toString()-returns a string representation of the list such as "[3,42,-7,15]"
6. addAll(list)-adds all elements from the given list to this list (at the end of the list)
7. revers ()-reverses the ArrayList.
8. palindrome()- Returns the number of missing elements required to transform the ArrayList into a palindrome.
Write a Java program to test all the methods of your MyArrayList class.

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 Databases Questions!