Repository: commons-lang Updated Branches: refs/heads/master 672cd146f -> 89cd538ea
LANG-1392: Methods for getting first non empty or non blank value Improve javadoc Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/89cd538e Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/89cd538e Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/89cd538e Branch: refs/heads/master Commit: 89cd538eaf7c555d33e7467ac8c2a51019c26372 Parents: 672cd14 Author: pascalschumacher <pascalschumac...@gmx.net> Authored: Fri Jun 8 19:34:32 2018 +0200 Committer: pascalschumacher <pascalschumac...@gmx.net> Committed: Fri Jun 8 19:34:32 2018 +0200 ---------------------------------------------------------------------- .../org/apache/commons/lang3/StringUtils.java | 42 +++++++++++--------- 1 file changed, 24 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/89cd538e/src/main/java/org/apache/commons/lang3/StringUtils.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 4e421d1..b3a92f4 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -7479,18 +7479,22 @@ public class StringUtils { } /** - * <p>Returns the first value in the array which is not blank. - * If all the values are blank or the array is {@code null} + * <p>Returns the first value in the array which is not empty (""), + * {@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> * * <pre> - * StringUtils.firstNonBlank(null, null, null) = null - * StringUtils.firstNonBlank(null, "", " ") = null - * StringUtils.firstNonBlank(null, null, " ") = null - * StringUtils.firstNonBlank("abc") = "abc" - * StringUtils.firstNonBlank(null, "xyz") = "xyz" - * StringUtils.firstNonBlank(null, "xyz", "abc") = "xyz" - * StringUtils.firstNonBlank() = null + * StringUtils.firstNonBlank(null, null, null) = null + * StringUtils.firstNonBlank(null, "", " ") = null + * StringUtils.firstNonBlank("abc") = "abc" + * StringUtils.firstNonBlank(null, "xyz") = "xyz" + * StringUtils.firstNonBlank(null, "", " ", "xyz") = "xyz" + * StringUtils.firstNonBlank(null, "xyz", "abc") = "xyz" + * StringUtils.firstNonBlank() = null * </pre> * * @param <T> the specific kind of CharSequence @@ -7512,18 +7516,20 @@ public class StringUtils { } /** - * <p>Returns the first value in the array which is not empty. - * If all the values are empty or the array is {@code null} + * <p>Returns the first value in the array which is not empty.</p> + * + * <p>If all values are empty or the array is {@code null} * or empty then {@code null} is returned.</p> * * <pre> - * StringUtils.firstNonBlank(null, null, null) = null - * StringUtils.firstNonBlank(null, "", " ") = " " - * StringUtils.firstNonBlank(null, null, "") = null - * StringUtils.firstNonBlank("abc") = "abc" - * StringUtils.firstNonBlank(null, "xyz") = "xyz" - * StringUtils.firstNonBlank(null, "xyz", "abc") = "xyz" - * StringUtils.firstNonBlank() = null + * StringUtils.firstNonEmpty(null, null, null) = null + * StringUtils.firstNonEmpty(null, null, "") = null + * StringUtils.firstNonEmpty(null, "", " ") = " " + * StringUtils.firstNonEmpty("abc") = "abc" + * StringUtils.firstNonEmpty(null, "xyz") = "xyz" + * StringUtils.firstNonEmpty("", "xyz") = "xyz" + * StringUtils.firstNonEmpty(null, "xyz", "abc") = "xyz" + * StringUtils.firstNonEmpty() = null * </pre> * * @param <T> the specific kind of CharSequence