You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2019/11/03 15:42:32 UTC

[groovy] 16/18: Trivial refactoring: Can be replaced with `size() != 1`

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

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

commit aa81c0e95719c0dfc262393799e6c7252acdf1df
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Nov 3 23:06:50 2019 +0800

    Trivial refactoring: Can be replaced with `size() != 1`
    
    (cherry picked from commit 56a9452fb99657bc885a28b797b5bcbe3d3669db)
---
 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");
         }