Question: Write a new mehod slice(int beginIndex, int endIndex) that returns a new ArrayListGeneric object containing the elemens of the calling list between beginIndex (inclusive) and

Write a new mehod slice(int beginIndex, int endIndex) that returns a new ArrayListGeneric object containing the elemens of the calling list between beginIndex (inclusive) and IndexOutOfBoundsException if an invalid index is supplied, or if beginIndex is no aleast 1 less than endIndex. Example: If list1 is an ArrayListGeneric object containing {1,2,3,3,6,2,2,3,1,4}, thten calling list1.slice(4,7) should return a new ArrayListGeneric object containing hte values at indices 4,5, and 6. The returned list would contain the element {6,2,2}.

Java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!