In this assignment, you'll be writing three methods related to ArrayLists.
The first method is countOdd(). This method takes an ArrayList as input and returns the number of odd numbers in the ArrayList. The method should have the following signature:
public static int countOdd(ArrayList<Integer> list) { }
The next method is checkDuplicates(). This method takes two ArrayList as input and returns true if there is a number that appears in both ArrayLists.
public static boolean checkDuplicates(ArrayList<Integer> list1, ArrayList<Integer> list2) { }
Finally, the last method is convertToArrayList(). Unlike the other methods, this method takes an int[] as input. The method returns an ArrayList containing the values from the int[].
public static ArrayList<Integer> convertToArrayList(int[] arr) { }
The easiest way to run your code is to press the play button in MyMain.java.
However, you can also run your code by typing the following into the Terminal.
make run
Alternatively, if that doesn't work, use:
./gradlew run
The easiest way to run your code is to press the play button in MyTests.java.
However, you can also run your code by typing the following into the Terminal.
make test
Alternatively, if that doesn't work, use:
./gradlew test