I\'m implementing compareTo() method for a simple class such as this (to be able to use Collections.sort() and other goodies offered by the Java pl
compareTo()
Collections.sort()
Another Apache ObjectUtils example. Able to sort other types of objects.
@Override public int compare(Object o1, Object o2) { String s1 = ObjectUtils.toString(o1); String s2 = ObjectUtils.toString(o2); return s1.toLowerCase().compareTo(s2.toLowerCase()); }