groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] branch master updated: Trivial refactoring: remove redundant 'Collection.addAll()' calls
Date Sun, 01 Dec 2019 11:50:12 GMT
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


The following commit(s) were added to refs/heads/master by this push:
     new bb52ea0  Trivial refactoring: remove redundant 'Collection.addAll()' calls
bb52ea0 is described below

commit bb52ea08a04966ffd18999acbdfa58cb81486864
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Sun Dec 1 19:49:11 2019 +0800

    Trivial refactoring: remove redundant 'Collection.addAll()' calls
---
 .../runtime/metaclass/ConcurrentReaderHashMap.java     | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/runtime/metaclass/ConcurrentReaderHashMap.java
b/src/main/java/org/codehaus/groovy/runtime/metaclass/ConcurrentReaderHashMap.java
index 1337b77..4ca393a 100644
--- a/src/main/java/org/codehaus/groovy/runtime/metaclass/ConcurrentReaderHashMap.java
+++ b/src/main/java/org/codehaus/groovy/runtime/metaclass/ConcurrentReaderHashMap.java
@@ -865,13 +865,11 @@ public class ConcurrentReaderHashMap
       ConcurrentReaderHashMap.this.clear();
     }
     public Object[] toArray() {
-      Collection c = new ArrayList();
-        c.addAll(this);
+      Collection c = new ArrayList(this);
       return c.toArray();
     }
     public Object[] toArray(Object[] a) {
-      Collection c = new ArrayList();
-      c.addAll(this);
+      Collection c = new ArrayList(this);
       return c.toArray(a);
     }
   }
@@ -906,13 +904,11 @@ public class ConcurrentReaderHashMap
       ConcurrentReaderHashMap.this.clear();
     }
     public Object[] toArray() {
-      Collection c = new ArrayList();
-      c.addAll(this);
+      Collection c = new ArrayList(this);
       return c.toArray();
     }
     public Object[] toArray(Object[] a) {
-      Collection c = new ArrayList();
-      c.addAll(this);
+      Collection c = new ArrayList(this);
       return c.toArray(a);
     }
   }
@@ -957,13 +953,11 @@ public class ConcurrentReaderHashMap
       ConcurrentReaderHashMap.this.clear();
     }
     public Object[] toArray() {
-      Collection c = new ArrayList();
-      c.addAll(this);
+      Collection c = new ArrayList(this);
       return c.toArray();
     }
     public Object[] toArray(Object[] a) {
-      Collection c = new ArrayList();
-      c.addAll(this);
+      Collection c = new ArrayList(this);
       return c.toArray(a);
     }
   }


Mime
View raw message