Indeed, I'm not sure about a way to improve it. I think we should let null here and wait for a NPE. Still an exception, but not one hiding the real problem : there should not be a null input here. NPEs are documented to be expected if a Comparator does not accept null input. This one does not.