A Create a Class called with public static methods that provide solutions to the following.  These are very similar, but not identical to the Practice-IT suggested problems.  To be certain we all know how to use compareTo() from Comparable, I will test these methods using the from our text.  To be certain to use the methods of the Comparable interface.  You may assume the passed list parameter is not null, but it could be empty.


A. Write a method minToFront that takes an ArrayList<CalendarDate> as a parameter and that moves the minimum value in the list to the front, otherwise preserving the order of the elements. (page 697 in text has a similar example using int).

B. Write a method removeDuplicates that takes as a parameter an ArrayList<CalendarDate>and eliminates all later duplicates from the list.  Do NOT assume the list is sorted, and do NOT sort the list. (page 697 in text has a similar example using String, but lacks examination of an empty collection, and you should also think about a case with hundreds of duplicates).

C. Write a method called removeInRange that accepts three parameters: an ArrayList<CalendarDate> a minimum object, and a maximum object. The method’s behavior is to remove all objects in the list between the minumum (inclusive) and the maximum (inclusive).  A similar example is shown on page 698 of text using Strings.

D. Write a method swapPairs that switches the order of values in an ArrayList<CalendarDate> in a pairwise fashion. Your method should switch the order of the first two values, then switch the order of the next two, switch the order of the next two, and so on. For example, if the list initially stores these value{p1,p2,p3,p4,p5} your method should switch the first pair, p1, p2, etc…., to yield this list: {p2,p1,p4,p3,p5}.