LANG-1392: Methods for getting first non empty or non blank value

Improve javadoc
This commit is contained in:
pascalschumacher 2018-06-08 19:34:32 +02:00
parent 672cd146f2
commit 89cd538eaf
1 changed files with 24 additions and 18 deletions

View File

@ -7479,16 +7479,20 @@ public class StringUtils {
} }
/** /**
* <p>Returns the first value in the array which is not blank. * <p>Returns the first value in the array which is not empty (""),
* If all the values are blank or the array is {@code null} * {@code null} or whitespace only.</p>
*
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
*
* <p>If all values are blank or the array is {@code null}
* or empty then {@code null} is returned.</p> * or empty then {@code null} is returned.</p>
* *
* <pre> * <pre>
* StringUtils.firstNonBlank(null, null, null) = null * StringUtils.firstNonBlank(null, null, null) = null
* StringUtils.firstNonBlank(null, "", " ") = null * StringUtils.firstNonBlank(null, "", " ") = null
* StringUtils.firstNonBlank(null, null, " ") = null
* StringUtils.firstNonBlank("abc") = "abc" * StringUtils.firstNonBlank("abc") = "abc"
* StringUtils.firstNonBlank(null, "xyz") = "xyz" * StringUtils.firstNonBlank(null, "xyz") = "xyz"
* StringUtils.firstNonBlank(null, "", " ", "xyz") = "xyz"
* StringUtils.firstNonBlank(null, "xyz", "abc") = "xyz" * StringUtils.firstNonBlank(null, "xyz", "abc") = "xyz"
* StringUtils.firstNonBlank() = null * StringUtils.firstNonBlank() = null
* </pre> * </pre>
@ -7512,18 +7516,20 @@ public class StringUtils {
} }
/** /**
* <p>Returns the first value in the array which is not empty. * <p>Returns the first value in the array which is not empty.</p>
* If all the values are empty or the array is {@code null} *
* <p>If all values are empty or the array is {@code null}
* or empty then {@code null} is returned.</p> * or empty then {@code null} is returned.</p>
* *
* <pre> * <pre>
* StringUtils.firstNonBlank(null, null, null) = null * StringUtils.firstNonEmpty(null, null, null) = null
* StringUtils.firstNonBlank(null, "", " ") = " " * StringUtils.firstNonEmpty(null, null, "") = null
* StringUtils.firstNonBlank(null, null, "") = null * StringUtils.firstNonEmpty(null, "", " ") = " "
* StringUtils.firstNonBlank("abc") = "abc" * StringUtils.firstNonEmpty("abc") = "abc"
* StringUtils.firstNonBlank(null, "xyz") = "xyz" * StringUtils.firstNonEmpty(null, "xyz") = "xyz"
* StringUtils.firstNonBlank(null, "xyz", "abc") = "xyz" * StringUtils.firstNonEmpty("", "xyz") = "xyz"
* StringUtils.firstNonBlank() = null * StringUtils.firstNonEmpty(null, "xyz", "abc") = "xyz"
* StringUtils.firstNonEmpty() = null
* </pre> * </pre>
* *
* @param <T> the specific kind of CharSequence * @param <T> the specific kind of CharSequence