You may find NullComparator in [collections] useful.
Stephen

----- Original Message ----- From: "Sualeh Fatehi" <[EMAIL PROTECTED]>
I have not done an extensive search of the mailing list archives, but I was
wondering if something like the following comparison functions with support
for null values may be useful in commons lang StringUtils (and also
DateUtils and NumberUtils):


public static int compare(String left, String right) {
 if (left == right) {
   return 0;
 }
 if (left == null) {
   return -1;
 }
 if (right == null) {
   return 1;
 }
 return left.compareTo(right);
}

Sualeh.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to