Question: Fill in the definitions to the three ArrayList utility methods in the ALUtils class which is outlined below and included in the code pack for

Fill in the definitions to the three ArrayList utility methods in the ALUtils class which is outlined below and included in the code pack for this lab. The methods are described adequately via Javadoc comments, and there are examples below.

import java.util.*; public class ALUtils{ /** * Creates and returns a copy of the parameter xs, with all items in the * reversed order. Does not modify the original list. When the parameter * is null, the result is an empty list. * * @param xs the list to create a reversed version * @return the reversed version of the parameter a. */ public static  ArrayList reverse(ArrayList xs){ // Your definition here throw new UnsupportedOperationException("unimplemented!"); } /** * Creates and returns copy of the given ArrayList xs, rotating * elements away from the front (and wrapping back in from end to * front) as many times as there is positive shift quantity. When * xs is null, the answer is an empty list. * * @param xs the list from which to create a rotated version * @param shift # spaces each item shifts away from front (when positive) * @return the rotated version of the input list. */ public static  ArrayList rotate(ArrayList xs, int shift){ // Your definition here throw new UnsupportedOperationException("unimplemented!"); } /** * Creates and returns a new ArrayList by interleaving elements from the * two parameter ArrayLists. If either list is longer, its extra elements * are preserved at the end of the answer list. The answer's size equals * the sum of the parameter lists' sizes, always. If either list is null, * it is treated like an empty list (contributes no items). The answer is * never null. * * @param xs the first parameter list * @param ys the second parameter list * @return the interlaced combination of the two lists. */ public static  ArrayList interlace(ArrayList xs, ArrayList ys){ // Your definition here throw new UnsupportedOperationException("unimplemented!"); } }

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!