StreamToLoopInspection#ensureCodeBlock refactored to use PsiTreeUtil.mark/releaseMark (IDEA-CR-16755)

RefactoringUtil#expandExpressionLambdaToCodeBlock reverted (now changes there unnecessary)
void single-expression lambda support
This commit is contained in:
Tagir Valeev
2016-12-14 17:57:02 +07:00
parent 641c2d7304
commit 81e951bf90
4 changed files with 66 additions and 21 deletions
@@ -0,0 +1,20 @@
// "Replace Stream API chain with loop" "true"
import java.util.Objects;
import java.util.stream.Stream;
public class Main {
public void test(String... list) {
Runnable s = () -> {
for (String s1 : list) {
if (Objects.nonNull(s1)) {
System.out.println(s1);
}
}
};
}
public static void main(String[] args) {
new Main().test("a", "bbb", null, "cc", "dd", "eedasfasdfs");
}
}
@@ -0,0 +1,15 @@
// "Replace Stream API chain with loop" "true"
import java.util.Objects;
import java.util.stream.Stream;
public class Main {
public void test(String... list) {
Runnable s = () -> Stream.of(list)
.filter(Objects::nonNull).for<caret>Each(System.out::println);
}
public static void main(String[] args) {
new Main().test("a", "bbb", null, "cc", "dd", "eedasfasdfs");
}
}