Question: just the method; no other code is necessary write a Java static method circulate which takes an ArrayList Integer> and creates a shifted copy of
just the method; no other code is necessary
write a Java static method circulate which takes an ArrayList Integer> and creates a shifted copy of it. Circulate shifts all elements forward in the list to a new position based on the integer parameter index. If the elements shift off the end of the list, they wrap around to the beginning. Here is the header for this method: ArrayListInteger Circulate (ArrayListInteger list, int index) You can assume that parameters 1ist is not null and index is non-negative. Here are some examples: A. If the passed list is: [0, 1, 2, 3, 4, 5] and index = 2, the returned list will be: [4, 5, 0, 1, 2, 3] B. If the passed list is: [0, 1, 2, 3, 4, 5] and index = 6, the returned list will be: [e, 1, 2, 3, 4, 5] If the passed list is: the returned list will be: [1, 2, 3, 4, 5, 0]? C. [0, 1, 2, 3, 4, 5] and index = 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
