StreamToLoop tests grouped

This commit is contained in:
Tagir Valeev
2017-01-27 17:38:37 +07:00
parent babce0b78c
commit fb6ba726e5
307 changed files with 2749 additions and 4686 deletions

View File

@@ -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;
@@ -9,6 +9,10 @@ public class Main {
return list.stream().filter(x -> x != null).flatMap(x -> x.stream()).anyMat<caret>ch(x -> x.startsWith("a"));
}
String testTernary(String[] strings) {
return Arrays.stream(strings).filter(Objects::nonNull).anyMatch(s -> !s.startsWith("xyz")) ? "s" : null;
}
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"))));