I'm currently working on a project which is in Java 4 and I have to sort an ArrayList by 2 values. This is an ArrayList of ClassTest.
public class ClassTest{
String code; // "01", "02" or "03".
String date; // 01/01/2001.
}
My problem is that I have to sort in first by code and after by the closest date of the current date. I'm in Java 4 and I can't use many things I usually used for sorting an Array like Comparator<ClassTest>.
What algorithm can I use that isn't too slow?
Using Comparator interface, without Generics (<..>)
Note: The code is tested in Java 1.4 version and works as expected