mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 10:48:09 +07:00
StreamToLoop tests grouped
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
// "Fix all 'Stream API call chain can be replaced with loop' problems in file" "true"
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
@@ -18,8 +18,62 @@ public class Main {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean testEqEq(List<String> list) {
|
||||
for (String s : list) {
|
||||
if (s.trim() != s.toLowerCase()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void testIf(List<List<String>> list) {
|
||||
boolean b = true;
|
||||
OUTER:
|
||||
for (List<String> x : list) {
|
||||
if (x != null) {
|
||||
for (String s : x) {
|
||||
if (!s.startsWith("a")) {
|
||||
b = false;
|
||||
break OUTER;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(b) {
|
||||
System.out.println("ok");
|
||||
}
|
||||
}
|
||||
|
||||
boolean testNot(String... strings) {
|
||||
for (String s : strings) {
|
||||
if (s != null) {
|
||||
if (!s.startsWith("xyz")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void testVar(List<Integer> list) {
|
||||
boolean x = false;
|
||||
for (Integer i : list) {
|
||||
if (i <= 2) {
|
||||
x = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(x) {
|
||||
System.out.println("found");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(test(asList(asList(), asList("a"), asList("b", "c"))));
|
||||
System.out.println(test(asList(asList(), asList("d"), asList("b", "c"))));
|
||||
System.out.println(testEqEq(Arrays.asList("a", "b", "c")));
|
||||
System.out.println(testIf(asList(asList(), asList("a"), asList("b", "c"))));
|
||||
System.out.println(testIf(asList(asList(), asList("d"), asList("b", "c"))));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user