StringUtils improve is*Empty and is*Blank javadoc

This commit is contained in:
pascalschumacher 2016-11-30 21:55:24 +01:00
parent 82d76aca8b
commit 1b362986bc
1 changed files with 17 additions and 12 deletions

View File

@ -230,7 +230,7 @@ public class StringUtils {
} }
/** /**
* <p>Checks if any one of the CharSequences are empty ("") or null.</p> * <p>Checks if any of the CharSequences are empty ("") or null.</p>
* *
* <pre> * <pre>
* StringUtils.isAnyEmpty(null) = true * StringUtils.isAnyEmpty(null) = true
@ -259,10 +259,11 @@ public class StringUtils {
} }
/** /**
* <p>Checks if any one of the CharSequences are not empty ("") or null.</p> * <p>Checks if any of the CharSequences are not empty ("") and not null.</p>
* *
* <pre> * <pre>
* StringUtils.isAnyNotEmpty(null) = false * StringUtils.isAnyNotEmpty(null) = false
* StringUtils.isAnyNotEmpty(new String[] {}) = false
* StringUtils.isAnyNotEmpty(null, "foo") = true * StringUtils.isAnyNotEmpty(null, "foo") = true
* StringUtils.isAnyNotEmpty("", "bar") = true * StringUtils.isAnyNotEmpty("", "bar") = true
* StringUtils.isAnyNotEmpty("bob", "") = true * StringUtils.isAnyNotEmpty("bob", "") = true
@ -272,7 +273,7 @@ public class StringUtils {
* </pre> * </pre>
* *
* @param css the CharSequences to check, may be null or empty * @param css the CharSequences to check, may be null or empty
* @return {@code true} if any of the CharSequences are not empty or null * @return {@code true} if any of the CharSequences are not empty and not null
* @since 3.6 * @since 3.6
*/ */
public static boolean isAnyNotEmpty(final CharSequence... css) { public static boolean isAnyNotEmpty(final CharSequence... css) {
@ -296,6 +297,7 @@ public class StringUtils {
* StringUtils.isNoneEmpty("", "bar") = false * StringUtils.isNoneEmpty("", "bar") = false
* StringUtils.isNoneEmpty("bob", "") = false * StringUtils.isNoneEmpty("bob", "") = false
* StringUtils.isNoneEmpty(" bob ", null) = false * StringUtils.isNoneEmpty(" bob ", null) = false
* StringUtils.isNoneEmpty(new String[] {}) = false
* StringUtils.isNoneEmpty(" ", "bar") = true * StringUtils.isNoneEmpty(" ", "bar") = true
* StringUtils.isNoneEmpty("foo", "bar") = true * StringUtils.isNoneEmpty("foo", "bar") = true
* </pre> * </pre>
@ -309,7 +311,7 @@ public class StringUtils {
} }
/** /**
* <p>Checks if a CharSequence is whitespace, empty ("") or null.</p> * <p>Checks if a CharSequence is empty (""), null or whitespace only.</p>
* *
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p> * </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
* *
@ -322,7 +324,7 @@ public class StringUtils {
* </pre> * </pre>
* *
* @param cs the CharSequence to check, may be null * @param cs the CharSequence to check, may be null
* @return {@code true} if the CharSequence is null, empty or whitespace * @return {@code true} if the CharSequence is null, empty or whitespace only
* @since 2.0 * @since 2.0
* @since 3.0 Changed signature from isBlank(String) to isBlank(CharSequence) * @since 3.0 Changed signature from isBlank(String) to isBlank(CharSequence)
*/ */
@ -354,7 +356,7 @@ public class StringUtils {
* *
* @param cs the CharSequence to check, may be null * @param cs the CharSequence to check, may be null
* @return {@code true} if the CharSequence is * @return {@code true} if the CharSequence is
* not empty and not null and not whitespace * not empty and not null and not whitespace only
* @since 2.0 * @since 2.0
* @since 3.0 Changed signature from isNotBlank(String) to isNotBlank(CharSequence) * @since 3.0 Changed signature from isNotBlank(String) to isNotBlank(CharSequence)
*/ */
@ -363,7 +365,7 @@ public class StringUtils {
} }
/** /**
* <p>Checks if any one of the CharSequences are blank ("") or null and not whitespace only.</p> * <p>Checks if any of the CharSequences are empty ("") or null or whitespace only.</p>
* *
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p> * </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
* *
@ -375,11 +377,12 @@ public class StringUtils {
* StringUtils.isAnyBlank("bob", "") = true * StringUtils.isAnyBlank("bob", "") = true
* StringUtils.isAnyBlank(" bob ", null) = true * StringUtils.isAnyBlank(" bob ", null) = true
* StringUtils.isAnyBlank(" ", "bar") = true * StringUtils.isAnyBlank(" ", "bar") = true
* StringUtils.isAnyBlank(new String[] {}) = false
* StringUtils.isAnyBlank("foo", "bar") = false * StringUtils.isAnyBlank("foo", "bar") = false
* </pre> * </pre>
* *
* @param css the CharSequences to check, may be null or empty * @param css the CharSequences to check, may be null or empty
* @return {@code true} if any of the CharSequences are blank or null or whitespace only * @return {@code true} if any of the CharSequences are empty or null or whitespace only
* @since 3.2 * @since 3.2
*/ */
public static boolean isAnyBlank(final CharSequence... css) { public static boolean isAnyBlank(final CharSequence... css) {
@ -395,7 +398,7 @@ public class StringUtils {
} }
/** /**
* <p>Checks if any one of the CharSequences are not blank ("") or null and not whitespace only.</p> * <p>Checks if any of the CharSequences are not empty (""), not null and not whitespace only.</p>
* *
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p> * </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
* *
@ -408,10 +411,11 @@ public class StringUtils {
* StringUtils.isAnyNotBlank(" bob ", null) = true * StringUtils.isAnyNotBlank(" bob ", null) = true
* StringUtils.isAnyNotBlank(" ", "bar") = true * StringUtils.isAnyNotBlank(" ", "bar") = true
* StringUtils.isAnyNotBlank("foo", "bar") = false * StringUtils.isAnyNotBlank("foo", "bar") = false
* StringUtils.isAnyNotBlank(new String[] {}) = false
* </pre> * </pre>
* *
* @param css the CharSequences to check, may be null or empty * @param css the CharSequences to check, may be null or empty
* @return {@code true} if any of the CharSequences are not blank or null or whitespace only * @return {@code true} if any of the CharSequences are not empty and not null and not whitespace only
* @since 3.6 * @since 3.6
*/ */
public static boolean isAnyNotBlank(final CharSequence... css) { public static boolean isAnyNotBlank(final CharSequence... css) {
@ -427,7 +431,7 @@ public class StringUtils {
} }
/** /**
* <p>Checks if none of the CharSequences are blank ("") or null and whitespace only.</p> * <p>Checks if none of the CharSequences are empty (""), null or whitespace only.</p>
* *
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p> * </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
* *
@ -439,11 +443,12 @@ public class StringUtils {
* StringUtils.isNoneBlank("bob", "") = false * StringUtils.isNoneBlank("bob", "") = false
* StringUtils.isNoneBlank(" bob ", null) = false * StringUtils.isNoneBlank(" bob ", null) = false
* StringUtils.isNoneBlank(" ", "bar") = false * StringUtils.isNoneBlank(" ", "bar") = false
* StringUtils.isNoneBlank(new String[] {}) = false
* StringUtils.isNoneBlank("foo", "bar") = true * StringUtils.isNoneBlank("foo", "bar") = true
* </pre> * </pre>
* *
* @param css the CharSequences to check, may be null or empty * @param css the CharSequences to check, may be null or empty
* @return {@code true} if none of the CharSequences are blank or null or whitespace only * @return {@code true} if none of the CharSequences are empty or null or whitespace only
* @since 3.2 * @since 3.2
*/ */
public static boolean isNoneBlank(final CharSequence... css) { public static boolean isNoneBlank(final CharSequence... css) {