code cleanup - use singletonList for single element collections

This commit is contained in:
Egor.Ushakov
2014-10-29 16:08:44 +03:00
parent 89fbb331fd
commit 6a08e626c6
3 changed files with 7 additions and 11 deletions
@@ -32,7 +32,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
@@ -176,7 +175,7 @@ public class JavaExecutionStack extends XExecutionStack {
}
if (first || DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES || (!frame.getDescriptor().isSynthetic() && !frame.getDescriptor().isInLibraryContent())) {
if (++myAdded > mySkip) {
myContainer.addStackFrames(Arrays.asList(frame), false);
myContainer.addStackFrames(Collections.singletonList(frame), false);
}
}
myDebugProcess.getManagerThread().schedule(
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
@@ -88,7 +88,7 @@ class ImageObjectRenderer extends CompoundReferenceRenderer implements FullValue
if (cls != null) {
List<Method> methods = cls.methodsByName(methodName);
if (!methods.isEmpty()) {
return process.invokeMethod(evaluationContext, cls, methods.get(0), Arrays.asList(obj));
return process.invokeMethod(evaluationContext, cls, methods.get(0), Collections.singletonList(obj));
}
}
return null;
@@ -50,10 +50,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes;
import javax.tools.*;
import java.io.ByteArrayOutputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.*;
/**
* @author egor
@@ -250,9 +247,9 @@ public class CompilingEvaluator implements ExpressionEvaluator {
StringReference url = proxy.mirrorOf("file:a");
keep(url, context);
ObjectReference reference = classType.newInstance(threadReference, classType.concreteMethodByName("<init>", "(Ljava/lang/String;)V"),
Arrays.asList(url), ClassType.INVOKE_SINGLE_THREADED);
Collections.singletonList(url), ClassType.INVOKE_SINGLE_THREADED);
keep(reference, context);
arrayRef.setValues(Arrays.asList(reference));
arrayRef.setValues(Collections.singletonList(reference));
return arrayRef;
}
@@ -290,7 +287,7 @@ public class CompilingEvaluator implements ExpressionEvaluator {
diagnostic,
options,
null,
Arrays.asList(new SourceFileObject(getMainClassName(), JavaFileObject.Kind.SOURCE, getClassCode()))
Collections.singletonList(new SourceFileObject(getMainClassName(), JavaFileObject.Kind.SOURCE, getClassCode()))
).call()) {
StringBuilder res = new StringBuilder("Compilation failed:\n");
for (Diagnostic<? extends JavaFileObject> d : diagnostic.getDiagnostics()) {