move StreamApiMigrationInspection to separate package, extract inner classes, add "suggest foreach" option, restore comments in anyMatch/findFirst/etc., fix trivial replacements with anyMatch/findFirst

This commit is contained in:
Tagir Valeev
2016-09-20 13:37:14 +07:00
parent 8cbf610859
commit 70ab891daf
16 changed files with 735 additions and 514 deletions
@@ -4,6 +4,7 @@ import java.util.Arrays;
public class Main {
boolean find(String[][] data) {
// Comment
return Arrays.stream(data).flatMap(Arrays::stream).allMatch(str -> str.startsWith("xyz"));
}
}
@@ -5,6 +5,9 @@ import java.util.List;
public class Main {
public static String find(List<List<String>> list) {
/*
Block comment
*/
return list.stream().flatMap(Collection::stream).filter(string -> string.startsWith("ABC")).findFirst().map(string -> string.substring(3)).orElse("");
}
}
@@ -7,6 +7,7 @@ import java.util.Objects;
public class Main {
public void testMap(Map<String, List<String>> map) throws Exception {
int firstSize = map.values().stream().filter(Objects::nonNull).findFirst().map(List::size).orElse(0);
// comment
System.out.println(firstSize);
}
}
@@ -5,6 +5,7 @@ public class Main {
for(String[] arr : da<caret>ta) {
for(String str : arr) {
if(!str.startsWith("xyz")) {
// Comment
return false;
}
}
@@ -8,6 +8,9 @@ public class Main {
for(String string : innerList) {
if(string.startsWith("ABC")) {
return string.substring(3);
/*
Block comment
*/
}
}
}
@@ -9,6 +9,7 @@ public class Main {
for(List<String> list : map.valu<caret>es()) {
if(list != null) {
firstSize = list.size();
// comment
break;
}
}