mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
support return in forEach replacement
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
class Sample {
|
||||
List<String> foo = new ArrayList<>();
|
||||
{
|
||||
foo.stream().filter(Objects::isNull).forEach(s -> {
|
||||
return;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with forEach" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
public class Test {
|
||||
void test(int[] arr) {
|
||||
Arrays.stream(arr).forEach(x -> {
|
||||
int y = x * 2;
|
||||
if (x > y) return;
|
||||
System.out.println(x);
|
||||
});
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// "Replace with forEach" "false"
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,4 +12,4 @@ class Sample {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
// "Replace with forEach" "true"
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class Test {
|
||||
void test(int[] arr) {
|
||||
for<caret>(int x : arr) {
|
||||
int y = x*2;
|
||||
if(x > y) continue;
|
||||
System.out.println(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user