Files
openide/java/java-tests/testData/inspection/collectionAddAllCanBeReplacedWithConstructor/beforeSideEffectBetween.java
Tagir Valeev 5bb73b4408 CollectionAddAllCanBeReplacedWithConstructor: fixed, enabled by default
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
2017-09-27 14:24:13 +07:00

25 lines
530 B
Java

// "Replace 'addAll()' call with parametrized constructor call" "true"
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class Test {
String foo;
void test() {
List<String> list = new ArrayList<>();
foo = "bar";
list.a<caret>ddAll(getSomething());
System.out.println(list);
}
private Collection<String> getSomething() {
return Collections.singleton(foo);
}
public static void main(String[] args) {
new Test().test();
}
}