aboutsummaryrefslogtreecommitdiffstats
path: root/util/src/main
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-15 16:33:00 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-15 16:36:00 +0200
commit2409bcbc7c9606b055e23f52d688eecda84351d6 (patch)
treee775e9d0e033ec563236c31623f66d023c40aac5 /util/src/main
parent3641f1626df6b9b1c11dd3f16b01a01495f4662d (diff)
downloadaspectj-2409bcbc7c9606b055e23f52d688eecda84351d6.tar.gz
aspectj-2409bcbc7c9606b055e23f52d688eecda84351d6.zip
Redundant Collection.addAll() call
Reports Collection.addAll() and Map.putAll() calls after instantiation of a collection using a constructor call without arguments. Such constructs can be replaced with a single call to a parametrized constructor which simplifies code. Also for some collections the replacement might be more performant. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'util/src/main')
-rw-r--r--util/src/main/java/org/aspectj/util/LangUtil.java3
1 files changed, 1 insertions, 2 deletions
diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java
index 98f53e3c8..e97438b0e 100644
--- a/util/src/main/java/org/aspectj/util/LangUtil.java
+++ b/util/src/main/java/org/aspectj/util/LangUtil.java
@@ -1000,8 +1000,7 @@ public class LangUtil {
if ((null == array) || (1 > array.length)) {
return Collections.emptyList();
}
- ArrayList<T> list = new ArrayList<>();
- list.addAll(Arrays.asList(array));
+ ArrayList<T> list = new ArrayList<>(Arrays.asList(array));
return list;
}