mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
StreamApiMigrationInspection: fix noneMatch()/allMatch() quick-fix name when continue is used; prettier Optional code generated in some cases
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with allMatch()" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Main {
|
||||
boolean find(String[][] data) {
|
||||
return Arrays.stream(data).flatMap(Arrays::stream).allMatch(str -> str.startsWith("xyz"));
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with findFirst()" "true"
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
public static boolean find(List<List<String>> list) {
|
||||
/*
|
||||
Block comment
|
||||
*/
|
||||
return list.stream().flatMap(Collection::stream).filter(string -> string.startsWith("ABC")).findFirst().filter(string -> string.substring(3).equals("xyz")).isPresent();
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace with findFirst()" "true"
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
public static String find(List<List<String>> list) {
|
||||
return list.stream().flatMap(Collection::stream).filter(string -> string.startsWith("ABC")).findFirst().filter(string -> string.substring(3).equals("xyz")).map(String::trim).orElse(null);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with noneMatch()" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Main {
|
||||
boolean find(String[][] data) {
|
||||
return Arrays.stream(data).flatMap(Arrays::stream).noneMatch(str -> str.startsWith("xyz"));
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with allMatch()" "true"
|
||||
|
||||
public class Main {
|
||||
boolean find(String[][] data) {
|
||||
for(String[] arr : da<caret>ta) {
|
||||
for(String str : arr) {
|
||||
if(str.startsWith("xyz")) continue;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Replace with findFirst()" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
public static boolean find(List<List<String>> list) {
|
||||
for(List<String> innerList : li<caret>st) {
|
||||
for(String string : innerList) {
|
||||
if(string.startsWith("ABC")) {
|
||||
return string.substring(3).equals("xyz");
|
||||
/*
|
||||
Block comment
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Replace with findFirst()" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
public static String find(List<List<String>> list) {
|
||||
for(List<String> innerList : li<caret>st) {
|
||||
for(String string : innerList) {
|
||||
if(string.startsWith("ABC")) {
|
||||
return string.substring(3).equals("xyz") ? string.trim() : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with noneMatch()" "true"
|
||||
|
||||
public class Main {
|
||||
boolean find(String[][] data) {
|
||||
for(String[] arr : da<caret>ta) {
|
||||
for(String str : arr) {
|
||||
if(!str.startsWith("xyz")) continue;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user