Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a new class named SimArrayList that simulates the operations of the Java built-in array list. The SimArrayList class has the following fields and
Create a new class named SimArrayList that simulates the operations of the Java built-in array list. The SimArrayList class has the following fields and methods: 1. private T[] data-the internal storage. The initial size is 10. 2. public void add(T value) - Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). 3. public T get(int index) - return the element at specified position in the list. 4. public T remove(int index) - Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). 5. Other fields and methods (if any) should be set with the "private" modifier. 6. public static void main(String[] args) - use the following code to test your SimArrayList: public static void main(String[] args) { char[] A 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'); SimArrayList list = new SimArrayList (); for (char n: A) { } list.add(0, n); for (int i=0; i
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