Question: Java Vodafone TR 13:28 9653 Attachment Title 2) In this question, you will write ArrayList dlass. This class will contain given variables and methods below
Java Vodafone TR 13:28 9653 Attachment Title 2) In this question, you will write ArrayList dlass. This class will contain given variables and methods below El] data/Generic array used for storage of list elements.' sizecint /Current number of elements in the list. CAPACITY int default array capacity/ ArrayList)/* Creates an array list with default initial capacity. ArrayList(int capacity) Creates an array list with given initial capacity. " sizeO:int Retums the number of elements in the list. isEmptyboolean /*Tests whether the array list is empty." get int i):E Returns (but does not remove) the element at index i.- *Set(int i, E e):E Replaces the element at the specified index, and returns the element previously stored.7 add(int i. E e):void /.lnserts te given element at the specified index of the list, shifting all subsequent elements in the list one position further to make room.7 +removelint i):E Removes and returns the element at the given index, shifting all subsequent elements in the list one position closer to the front. *checkindex(int i, int n)void* Checks whether the given index is in the range [O, n-11. +resize(int capacity):void Resizes intemal array to have given capacity size. 1 +to StringString* Produces a string representation of the contents of the indexed list This exists for debugging purposes only. Write a main that tests all the methods. Without main class, you will get half point for this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
