mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 06:39:38 +07:00
StreamApiMigrationInspection: suggest to use takeWhile() in Java-9
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Test {
|
||||
public static void test(List<String> data) {
|
||||
List<String> result = data.stream().takeWhile(s -> !s.isEmpty()).collect(Collectors.toList());
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// "Replace with collect" "false"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
public static void test(List<String> data) {
|
||||
List<String> result = new ArrayList<>();
|
||||
for(String s : da<caret>ta) {
|
||||
if(s.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
result.add(s);
|
||||
}
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
public static void test(List<String> data) {
|
||||
List<String> result = new ArrayList<>();
|
||||
for(String s : da<caret>ta) {
|
||||
if(s.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
result.add(s);
|
||||
}
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user