Update compareTo(Object o) method in Java