added and used method compareTo