Question
MyList.java public interface MyList { /** THE STUDENT MUST WRITE THE METHOD HEADERS. THE FIRST ONE IS DONE FOR YOU **/ /** * Appends the
MyList.java
public interface MyList { /** THE STUDENT MUST WRITE THE METHOD HEADERS. THE FIRST ONE IS DONE FOR YOU **/ /** * Appends the specified element to the end of this list * @param data * @return boolean */ public boolean add(E data); /** * Inserts the specified element at the specified position in this list. * Shifts the element currently at that position (if any) and any subsequent * elements by adding one to their indices. * @param index - index at which the specified element is to be inserted * @param data - element to be inserted * @return boolean * @throws IndexOutOfBoundsException - if the index is out of range (index size()) */ add /** * Removes all of the elements from this list */ clear /** * Returns true if this list contains the specified element * @param data * @return boolean */ contains /** * Returns the element at the specified position in this list * @param index * @return E */ get /** * Returns the index of the first occurrence of the specified element in this list * Return, or -1 if this list does not * contain the element * @param data * @return int */ indexOf /** * Returns the index of the last matching of the element in this list * Return -1 if no match * @param data * @return int */ lastIndexOf /** * Returns true if this list contains no elements * @return boolean */ isEmpty /** * Removes the element at the specified position in this list. * Shifts any subsequent elements by subtracting one from their indices. * @param index - index of the element to be removed * @return E - the element that was removed from the list * IndexOutOfBoundsException - if the index is out of range (index = size()) */ remove /** * Trims the capacity of this ArrayList instance to be the list's current size. An application can use this * operation to minimize the storage of an ArrayList instance. */ trimToSize /** * Returns the number of elements in this list * @return int */ size }
Instructions for MyArrayList Hopefully you were able to code along with the video to implement your own ArrayList. We will begin with that code and complete the class. Most of the methods were written in the video. The code is also available on Blackboard/Week 4 in MyArrayList.zip Your MyArrayList class where you will implement MyList begins like this: public class MyArrayList extends MyAbstractList implements MyList After the functionality is complete and the bugs are worked out, the next step is to make MyArrayList a generic typed class by adding parameterized data type. Of course, MyAbstractList and MyList will also need the conversion applied to them. For grading, the class header will be: public class MyArrayListStep 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