Write a method called removeRange that accepts a starting and ending index as parameters and removes the

Question:

Write a method called removeRange that accepts a starting and ending index as parameters and removes the elements at those indexes (inclusive) from the list. For example, if a variable list stores the values [8, 13, 17, 4, 9, 12, 98, 41, 7, 23, 0, 92], the call of listRange.removeRange(3, 8); should remove values between index 3 and index 8 (the values 4 and 7 ), leaving the list of [8, 13, 17, 23, 0, 92]. The method should throw an IllegalArgumentException if either of the positions is negative. Otherwise you may assume that the positions represent a legal range of the list (0 ≤ and ≤ end < size).

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: