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
I know that it may be not directly answer to your question, because you said that null values have to be supported.
But I just want to note that supporting nulls in compareTo is not in line with compareTo contract described in official javadocs for Comparable:
Note that null is not an instance of any class, and e.compareTo(null) should throw a NullPointerException even though e.equals(null) returns false.
So I would either throw NullPointerException explicitly or just let it be thrown first time when null argument is being dereferenced.