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:50:12 UTC
[groovy] branch master updated: 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 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 <su...@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);
}
}