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/12/01 11:52:27 UTC
[groovy] 03/03: Trivial refactoring: remove redundant
'Collection.addAll()' calls
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 b9eac3b9947f0f94b943fd177b9c063ba7d6e4ce
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Dec 1 19:49:11 2019 +0800
Trivial refactoring: remove redundant 'Collection.addAll()' calls
(cherry picked from commit bb52ea08a04966ffd18999acbdfa58cb81486864)
---
.../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);
}
}