diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 16:33:00 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 16:36:00 +0200 |
commit | 2409bcbc7c9606b055e23f52d688eecda84351d6 (patch) | |
tree | e775e9d0e033ec563236c31623f66d023c40aac5 /build | |
parent | 3641f1626df6b9b1c11dd3f16b01a01495f4662d (diff) | |
download | aspectj-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 'build')
-rw-r--r-- | build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java | 3 | ||||
-rw-r--r-- | build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java index ed64e74e0..5d592243c 100644 --- a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java +++ b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java @@ -469,8 +469,7 @@ class HeaderInfo { this.lastLine = lastLine; this.file = file; this.hasLicense = hasLicense; - List<String> newYears = new ArrayList<>(); - newYears.addAll(years); + List<String> newYears = new ArrayList<>(years); Collections.sort(newYears); this.years = Collections.unmodifiableList(newYears); if ((null == file) || !file.canWrite()) { diff --git a/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java b/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java index 86782563f..bf9b9aab9 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java @@ -419,8 +419,7 @@ class Samples { } List<Sample> getSortedSamples(Comparator<Sample> comparer) { - ArrayList<Sample> result = new ArrayList<>(); - result.addAll(samples); + ArrayList<Sample> result = new ArrayList<>(samples); result.sort(comparer); return result; } |