The purpose of this assignment is to reinforce generics concepts. Specifically, the assigment is to the following 3 problems.
-
Write a generic method that returns an arraylist containing the distinct elements of the given arraylist. The method header should be public static <E extends Comparable> ArrayList distinct (ArrayList list)
-
Write a generic method that shuffles the elements of an arraylist. Do not use the shuffle method in the Java library. The method header should be public static void shuffle (ArrayList list)
-
Write a generic method that returns the largest element in an arraylist. The method header should be public static <E extends Comparable> E max (ArrayList list)