commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [2/2] [lang] revert "LANG-1270: Add StringUtils#isAnyNotEmpty and #isAnyNotBlank" and add "LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods" instead
Date Sun, 12 Mar 2017 16:21:41 GMT
revert "LANG-1270: Add StringUtils#isAnyNotEmpty and #isAnyNotBlank" and add "LANG-1293: Add
StringUtils#isAllEmpty and #isAllBlank methods" instead


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/3ce7f9ee
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/3ce7f9ee
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/3ce7f9ee

Branch: refs/heads/master
Commit: 3ce7f9eecfacbf3de716a8338ad4929371a66ca2
Parents: 6b9c331
Author: pascalschumacher <pascalschumacher@gmx.net>
Authored: Sun Mar 12 17:21:27 2017 +0100
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Sun Mar 12 17:21:27 2017 +0100

----------------------------------------------------------------------
 src/changes/changes.xml                         |  2 +-
 .../org/apache/commons/lang3/StringUtils.java   | 83 +++++---------------
 .../lang3/StringUtilsEmptyBlankTest.java        | 26 ------
 3 files changed, 19 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3ce7f9ee/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5b2cb64..595fcc8 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -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>

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3ce7f9ee/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 d91ad55..56a1c47 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -259,36 +259,6 @@ public class StringUtils {
     }
 
     /**
-     * <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>
      *
      * <pre>
@@ -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;
     }
 
     /**
@@ -421,39 +399,6 @@ public class StringUtils {
     }
 
     /**
-     * <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>
      * 
      * <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</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

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3ce7f9ee/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
index b04d0da..8e88f6e 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
@@ -57,19 +57,6 @@ public class StringUtilsEmptyBlankTest  {
     }
 
     @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));
         assertTrue(StringUtils.isNoneEmpty((String[]) null));
@@ -128,19 +115,6 @@ public class StringUtilsEmptyBlankTest  {
     }
 
     @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));
         assertTrue(StringUtils.isNoneBlank((String[]) null));


Mime
View raw message