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 2017/12/06 03:38:24 UTC

[4/5] groovy git commit: Minor refactoring (cherry picked from commit f2ad43d)

Minor refactoring
(cherry picked from commit f2ad43d)


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 3301d65172134a0dffc9ee466bc445f02c74402b
Parents: 64d1fc1
Author: sunlan <su...@apache.org>
Authored: Wed Dec 6 11:02:25 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Wed Dec 6 11:36:55 2017 +0800

----------------------------------------------------------------------
 src/main/groovy/lang/GString.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/3301d651/src/main/groovy/lang/GString.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/GString.java b/src/main/groovy/lang/GString.java
index 18846de..7a520fe 100644
--- a/src/main/groovy/lang/GString.java
+++ b/src/main/groovy/lang/GString.java
@@ -27,8 +27,8 @@ import java.io.Serializable;
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
+import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.regex.Pattern;
 
@@ -93,14 +93,14 @@ public abstract class GString extends GroovyObjectSupport implements Comparable,
     }
 
     public GString plus(GString that) {
-        List<String> stringList = new LinkedList<String>(Arrays.asList(getStrings()));
-        List<Object> valueList = new LinkedList<Object>(Arrays.asList(getValues()));
+        List<String> stringList = new ArrayList<String>(Arrays.asList(getStrings()));
+        List<Object> valueList = new ArrayList<Object>(Arrays.asList(getValues()));
 
         List<String> thatStrings = Arrays.asList(that.getStrings());
 
         int stringListSize = stringList.size();
         if (stringListSize > valueList.size()) {
-            thatStrings = new LinkedList<String>(thatStrings);
+            thatStrings = new ArrayList<String>(thatStrings);
             // merge onto end of previous GString to avoid an empty bridging value
             int lastIndexOfStringList = stringListSize - 1;
             String s = stringList.get(lastIndexOfStringList);