From a85308ec103a69a86a8e02adf02112d472b00568 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Sat, 15 Aug 2020 16:06:32 +0200 Subject: Manual array to collection copy Reports the copying of array contents to a collection where each element is added individually using a for loop. Such constructs may be replaced by a call to Collection.addAll(Arrays.asList()) or Collections.addAll(). Signed-off-by: Lars Grefer --- .../java/org/aspectj/apache/bcel/classfile/JavaClass.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'bcel-builder/src/main/java') diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java index dd1097ff0..bb42a07ee 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java @@ -60,12 +60,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.StringTokenizer; +import java.util.*; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; @@ -791,9 +786,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node { } } - for (JavaClass anInterface : interfaces) { - queue.add(anInterface); - } + Collections.addAll(queue, interfaces); } return interfaceList; -- cgit v1.2.3