Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please fill in the blank for 1,2,3 ArrayList - Coding Goal: Given the following class, which is an ArrayList with a and a variable (the

image text in transcribed

Please fill in the blank for 1,2,3

ArrayList - Coding Goal: Given the following class, which is an ArrayList with a and a variable (the same as your hamework) implement the method. This method will remave every element from the in the range (inclusivel to [exclusivel such that the element at will be deleted, but the element at will not be changed. The deleted elements must be stored in a new array to be returned at the end of the methad, with a length equal to the number of elements removed. Requirements: - Your code should be as efficient as possible. - You may assume that the list has a valid structure, but do not make arry other assumptions about the size or ordering of the list. - You chould not attempt to use any other methods of the dass. - You may assume that the passed in indices and form a valid range to remove data from, so there is no need to throw arry ewceptions, and | will always be less than - This methad must also maintain the cantiguity of the , meaning all elements cutside of the range must be shifted aver, and any trailing indices must be set to - The size variable must reflect the new size of the after the removal. Example: Initial k[6,1,2,3,4,5,6,7,8] is called Final if [8,1 Array public clasi Arraylist \& // INITAL_CAPACITY anitted privete T backingarray; private int size; publie Arraylisto \& 3 backingherey = (TD) rew Cbject [INITLAL_CAPMCITY]; /l implamantation initted * Rereves all af the elerwits in the spacified renge * Eparar indi the laner bound index to start removing date froe (inclusive) * Psarar ind2 the upper boend irdex to stop remering date from (exclusive) * Craturh a new array with all of the elensints that wire riremed ty public. T renaveRenge(int ind1, int ind2) \& TD arr = (TD) nen Object[ind2 - ind1]; for (int i= indi; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

=+Understand the fi eld of comparative IHRM.

Answered: 1 week ago