Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Implement the arraylist ADT as MyArrayList class implements Cloneable) with the following public methods: a. append(Object element) - appending the element at the end
1. Implement the arraylist ADT as MyArrayList class implements Cloneable) with the following public methods: a. append(Object element) - appending the element at the end of the arraylist b. clear() - make the arraylist collection empty C. contains (Object element) - check whether the arraylist contains the element d. elementat(int index) - access the element at the given index e. indexOf(Object element) - find the index of the element f. insert.At(int index, Object element) - insert the element at the given index g.isEmptyo - check whether the array list is empty h. removeAt(int index) - remove the element at the given index i. remove(Object element) - remove the element from the arraylist j. replace(int index, Object element) - replace the element at the given index with the given element k.size() - get the number of elements in the current arraylist 1. ensureCapacity (int minCapacity) - make sure the arraylist gets at least the given capacity m. clone) - returns a cloned copy of this arraylist n. removeRange(int fromIndex, int toIndex) - removes from this arraylist all of the elements whose index is between from Index, inclusive and toIndex, exclusive o.toString(- returns a string representation of this arraylist, containing the String representation of each element p. reverse() - reverse the elements in this arraylist 4. merge(MyArrayList arraylist2) - add all the elements in arraylist2 to the end of this arraylist 2. The MyArrayList class should be created in the collection package. 3. Your implementation should be a self-expanding arraylist, and behave like what we discussed in class. 4. After implementing the MyArrayList class you will test your MyArrayList class. To test the MyArrayList class you will create a Lab2 class under the lab package. 5. In the Lab2 class you will do the following: a. Search to find out what is the Fibonacci number sequence b. create a static method named test and do the following in this method i. create an instance of MyArrayList ii. add the first 25 Fibonacci numbers (starts with 0. 1. 1. 2. 3,5. 8. ...) into the arraylist based on the Fibonacci function, (not manually one by one, but by using a loop) 1. Implement the arraylist ADT as MyArrayList class implements Cloneable) with the following public methods: a. append(Object element) - appending the element at the end of the arraylist b. clear() - make the arraylist collection empty C. contains (Object element) - check whether the arraylist contains the element d. elementat(int index) - access the element at the given index e. indexOf(Object element) - find the index of the element f. insert.At(int index, Object element) - insert the element at the given index g.isEmptyo - check whether the array list is empty h. removeAt(int index) - remove the element at the given index i. remove(Object element) - remove the element from the arraylist j. replace(int index, Object element) - replace the element at the given index with the given element k.size() - get the number of elements in the current arraylist 1. ensureCapacity (int minCapacity) - make sure the arraylist gets at least the given capacity m. clone) - returns a cloned copy of this arraylist n. removeRange(int fromIndex, int toIndex) - removes from this arraylist all of the elements whose index is between from Index, inclusive and toIndex, exclusive o.toString(- returns a string representation of this arraylist, containing the String representation of each element p. reverse() - reverse the elements in this arraylist 4. merge(MyArrayList arraylist2) - add all the elements in arraylist2 to the end of this arraylist 2. The MyArrayList class should be created in the collection package. 3. Your implementation should be a self-expanding arraylist, and behave like what we discussed in class. 4. After implementing the MyArrayList class you will test your MyArrayList class. To test the MyArrayList class you will create a Lab2 class under the lab package. 5. In the Lab2 class you will do the following: a. Search to find out what is the Fibonacci number sequence b. create a static method named test and do the following in this method i. create an instance of MyArrayList ii. add the first 25 Fibonacci numbers (starts with 0. 1. 1. 2. 3,5. 8. ...) into the arraylist based on the Fibonacci function, (not manually one by one, but by using a loop)
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