revert "LANG-1270: Add StringUtils#isAnyNotEmpty and #isAnyNotBlank" and add "LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods" instead
This commit is contained in:
parent
6b9c331588
commit
3ce7f9eecf
|
@ -66,7 +66,7 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
<action issue="LANG-740" type="add" dev="pschumacher" due-to="James Sawle">Implementation of a Memomizer</action>
|
||||
<action issue="LANG-1258" type="add" dev="pschumacher" due-to="IG, Grzegorz Rożniecki">Add ArrayUtils#toStringArray method</action>
|
||||
<action issue="LANG-1160" type="add" dev="kinow">StringUtils#abbreviate should support 'custom ellipses' parameter</action>
|
||||
<action issue="LANG-1270" type="add" dev="pschumacher" due-to="Pierre Templier">Add StringUtils#isAnyNotEmpty and #isAnyNotBlank</action>
|
||||
<action issue="LANG-1293" type="add" dev="pschumacher" due-to="Pierre Templier, Martin Tarjanyi">Add StringUtils#isAllEmpty and #isAllBlank methods</action>
|
||||
<action issue="LANG-1291" type="add" dev="ggregory">Provide annotations to document thread safety</action>
|
||||
<action issue="LANG-1290" type="update" dev="pschumacher" due-to="Andrii Abramov">Increase test coverage of org.apache.commons.lang3.ArrayUtils</action>
|
||||
<action issue="LANG-1274" type="update" dev="pschumacher">StrSubstitutor should state its thread safety</action>
|
||||
|
|
|
@ -258,36 +258,6 @@ public class StringUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Checks if any of the CharSequences are not empty ("") and not null.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtils.isAnyNotEmpty(null) = false
|
||||
* StringUtils.isAnyNotEmpty(new String[] {}) = false
|
||||
* StringUtils.isAnyNotEmpty(null, "foo") = true
|
||||
* StringUtils.isAnyNotEmpty("", "bar") = true
|
||||
* StringUtils.isAnyNotEmpty("bob", "") = true
|
||||
* StringUtils.isAnyNotEmpty(" bob ", null) = true
|
||||
* StringUtils.isAnyNotEmpty(" ", "bar") = true
|
||||
* StringUtils.isAnyNotEmpty("foo", "bar") = true
|
||||
* </pre>
|
||||
*
|
||||
* @param css the CharSequences to check, may be null or empty
|
||||
* @return {@code true} if any of the CharSequences are not empty and not null
|
||||
* @since 3.6
|
||||
*/
|
||||
public static boolean isAnyNotEmpty(final CharSequence... css) {
|
||||
if (ArrayUtils.isEmpty(css)) {
|
||||
return false;
|
||||
}
|
||||
for (final CharSequence cs : css) {
|
||||
if (isNotEmpty(cs)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Checks if none of the CharSequences are empty ("") or null.</p>
|
||||
*
|
||||
|
@ -330,7 +300,15 @@ public class StringUtils {
|
|||
* @since 3.6
|
||||
*/
|
||||
public static boolean isAllEmpty(final CharSequence... css) {
|
||||
return !isAnyNotEmpty(css);
|
||||
if (ArrayUtils.isEmpty(css)) {
|
||||
return true;
|
||||
}
|
||||
for (final CharSequence cs : css) {
|
||||
if (isNotEmpty(cs)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -420,39 +398,6 @@ public class StringUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* <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>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtils.isAnyNotBlank(null) = false
|
||||
* StringUtils.isAnyNotBlank(null, "foo") = true
|
||||
* StringUtils.isAnyNotBlank(null, null) = false
|
||||
* StringUtils.isAnyNotBlank("", "bar") = true
|
||||
* StringUtils.isAnyNotBlank("bob", "") = true
|
||||
* StringUtils.isAnyNotBlank(" bob ", null) = true
|
||||
* StringUtils.isAnyNotBlank(" ", "bar") = true
|
||||
* StringUtils.isAnyNotBlank("foo", "bar") = true
|
||||
* StringUtils.isAnyNotBlank(new String[] {}) = false
|
||||
* </pre>
|
||||
*
|
||||
* @param css the CharSequences to check, may be null or empty
|
||||
* @return {@code true} if any of the CharSequences are not empty and not null and not whitespace only
|
||||
* @since 3.6
|
||||
*/
|
||||
public static boolean isAnyNotBlank(final CharSequence... css) {
|
||||
if (ArrayUtils.isEmpty(css)) {
|
||||
return false;
|
||||
}
|
||||
for (final CharSequence cs : css) {
|
||||
if (isNotBlank(cs)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Checks if none of the CharSequences are empty (""), null or whitespace only.</p>
|
||||
*
|
||||
|
@ -500,7 +445,15 @@ public class StringUtils {
|
|||
* @since 3.6
|
||||
*/
|
||||
public static boolean isAllBlank(final CharSequence... css) {
|
||||
return !isAnyNotBlank(css);
|
||||
if (ArrayUtils.isEmpty(css)) {
|
||||
return true;
|
||||
}
|
||||
for (final CharSequence cs : css) {
|
||||
if (isNotBlank(cs)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Trim
|
||||
|
|
|
@ -56,19 +56,6 @@ public class StringUtilsEmptyBlankTest {
|
|||
assertFalse(StringUtils.isAnyEmpty("foo", "bar"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAnyNotEmpty() {
|
||||
assertFalse(StringUtils.isAnyNotEmpty((String) null));
|
||||
assertFalse(StringUtils.isAnyNotEmpty((String[]) null));
|
||||
assertTrue(StringUtils.isAnyNotEmpty(null, "foo"));
|
||||
assertTrue(StringUtils.isAnyNotEmpty("", "bar"));
|
||||
assertTrue(StringUtils.isAnyNotEmpty("bob", ""));
|
||||
assertTrue(StringUtils.isAnyNotEmpty(" bob ", null));
|
||||
assertTrue(StringUtils.isAnyNotEmpty(" ", "bar"));
|
||||
assertTrue(StringUtils.isAnyNotEmpty("foo", "bar"));
|
||||
assertFalse(StringUtils.isAnyNotEmpty("", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsNoneEmpty() {
|
||||
assertFalse(StringUtils.isNoneEmpty((String) null));
|
||||
|
@ -127,19 +114,6 @@ public class StringUtilsEmptyBlankTest {
|
|||
assertFalse(StringUtils.isAnyBlank("foo", "bar"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAnyNotBlank() {
|
||||
assertFalse(StringUtils.isAnyNotBlank((String) null));
|
||||
assertFalse(StringUtils.isAnyNotBlank((String[]) null));
|
||||
assertTrue(StringUtils.isAnyNotBlank(null, "foo"));
|
||||
assertFalse(StringUtils.isAnyNotBlank(null, null));
|
||||
assertTrue(StringUtils.isAnyNotBlank("", "bar"));
|
||||
assertTrue(StringUtils.isAnyNotBlank("bob", ""));
|
||||
assertTrue(StringUtils.isAnyNotBlank(" bob ", null));
|
||||
assertTrue(StringUtils.isAnyNotBlank(" ", "bar"));
|
||||
assertTrue(StringUtils.isAnyNotBlank("foo", "bar"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsNoneBlank() {
|
||||
assertFalse(StringUtils.isNoneBlank((String) null));
|
||||
|
|
Loading…
Reference in New Issue