commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fredrik Westermarck <fredrik.westerma...@mdh.se>
Subject Re: [lang] New StringUtils method - defaultIfEmpty
Date Sat, 09 Apr 2005 07:49:33 GMT
Stephen Colebourne wrote:
> Currently we have two default methods, both of which default when the 
> string parameter is null. At my job we just had need of a default if 
> empty method:
> 
> public String defaultIfEmpty(String str, String defaultString) {
>  if (isEmpty(str)) {
>   return defaultString;
>  } else {
>   return str;
>  }
> }
> 
> Does this sound OK to add?

Since what you describe is a rather common use case I'm +1.

/Fredrik Westermarck


---------------------------------------------------------------------
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