groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleit...@apache.org
Subject [2/4] groovy git commit: minor refactor: use enhanced for loop
Date Sun, 07 Aug 2016 03:09:33 GMT
minor refactor: use enhanced for loop


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/037ff659
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/037ff659
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/037ff659

Branch: refs/heads/GROOVY_2_4_X
Commit: 037ff6598fd36096b46a5256e9999fb99ab76177
Parents: e23c7ef
Author: John Wagenleitner <jwagenleitner@apache.org>
Authored: Sat Aug 6 19:01:31 2016 -0700
Committer: John Wagenleitner <jwagenleitner@apache.org>
Committed: Sat Aug 6 20:00:23 2016 -0700

----------------------------------------------------------------------
 .../org/codehaus/groovy/jsr223/GroovyScriptEngineFactory.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/037ff659/subprojects/groovy-jsr223/src/main/java/org/codehaus/groovy/jsr223/GroovyScriptEngineFactory.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-jsr223/src/main/java/org/codehaus/groovy/jsr223/GroovyScriptEngineFactory.java
b/subprojects/groovy-jsr223/src/main/java/org/codehaus/groovy/jsr223/GroovyScriptEngineFactory.java
index b804b06..759ced7 100644
--- a/subprojects/groovy-jsr223/src/main/java/org/codehaus/groovy/jsr223/GroovyScriptEngineFactory.java
+++ b/subprojects/groovy-jsr223/src/main/java/org/codehaus/groovy/jsr223/GroovyScriptEngineFactory.java
@@ -180,10 +180,8 @@ public class GroovyScriptEngineFactory implements ScriptEngineFactory
{
 
     public String getProgram(String... statements) {
         StringBuilder ret = new StringBuilder();
-        int len = statements.length;
-        for (int i = 0; i < len; i++) {
-            ret.append(statements[i]);
-            ret.append('\n');
+        for (String statement : statements) {
+            ret.append(statement).append('\n');
         }
         return ret.toString();
     }


Mime
View raw message