mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 01:09:46 +07:00
IDEA-178761 Inspection 'Collection.addAll() can be replaced with parametrized constructor' should be turned on by default Fixes comments handling, possible semantics change; now suggested in more cases
27 lines
544 B
Java
27 lines
544 B
Java
// "Replace 'addAll()' call with parametrized constructor call" "true"
|
|
import java.util.*;
|
|
|
|
public class Test {
|
|
String foo;
|
|
|
|
void test() {
|
|
final List<String> list;
|
|
if(Math.random() > 0) {
|
|
list = new ArrayList<>();
|
|
foo = "bar";
|
|
list.a<caret>ddAll(getSomething());
|
|
System.out.println(list);
|
|
} else {
|
|
list = new LinkedList<>();
|
|
}
|
|
}
|
|
|
|
private Collection<String> getSomething() {
|
|
return Collections.singleton(foo);
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
new Test().test();
|
|
}
|
|
}
|