This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 56a9452fb99657bc885a28b797b5bcbe3d3669db
Author: Daniel Sun <[email protected]>
AuthorDate: Sun Nov 3 23:06:50 2019 +0800

    Trivial refactoring: Can be replaced with `size() != 1`
---
 src/main/java/groovy/util/NodeList.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/groovy/util/NodeList.java 
b/src/main/java/groovy/util/NodeList.java
index c4fac31..2aae2fb 100644
--- a/src/main/java/groovy/util/NodeList.java
+++ b/src/main/java/groovy/util/NodeList.java
@@ -185,7 +185,7 @@ public class NodeList extends ArrayList {
     }
 
     public Node replaceNode(Closure c) {
-        if (size() <= 0 || size() > 1) {
+        if (size() != 1) {
             throw new GroovyRuntimeException(
                     "replaceNode() can only be used to replace a single node, 
but was applied to " + size() + " nodes");
         }

Reply via email to