Question: just the method Write a Java static method circulate which takes an ArrayList and creates a shifted copy of it. Circulate shifts all elements forward
just the method
Write a Java static method circulate which takes an ArrayList 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 list 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] C. If the passed list is: [0, 1, 2, 3, 4, 5] and index = 5, the returned list will be: [1, 2, 3, 4, 5, 0]