commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [lang] commons lang: Comparisons with null support
Date Mon, 28 Feb 2005 21:39:15 GMT
You may find NullComparator in [collections] useful.
Stephen

----- Original Message ----- 
From: "Sualeh Fatehi" <sualeh@hotmail.com>
>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: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message