Roman Ženka
unread,Dec 13, 2010, 9:37:16 AM12/13/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to guava-discuss
Hello,
I would like to use ComparisonChain to implement compareTo methods on
my objects.
However, ComparisonChain requires all values to be non null, otherwise
it throws an NPE. Not all fields of my objects are non-null (I think
that is valid) and I still need to compare them (I think that is a
valid use, too).
I modified the ComparisonChain class, adding nullsFirst() and
nullsLast() methods that simply return a slightly different instance
of the ComparisonChain guaranteed not to throw an NPE. I find this
very convenient.
Is there something profoundly wrong with this idea? Would you consider
adding these methods if I send a patch?