defaultIfEmpty implemented
Stephen

Fredrik Westermarck wrote:
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: [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