Simplify equals() and compareTo().