mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
StreamApiMigrationInspection: support postfix limit conversion (like if(count++ > 100) break; => limit(102)) (IDEA-CR-16910)
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace with count()" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Main {
|
||||
public long test(String[] array) {
|
||||
long longStrings = Arrays.stream(array).map(String::trim).filter(trimmed -> trimmed.length() > 10).limit(102).count();
|
||||
return longStrings;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with count()" "true"
|
||||
|
||||
public class Main {
|
||||
public long test(String[] array) {
|
||||
long longStrings = 0;
|
||||
for(String str : a<caret>rray) {
|
||||
String trimmed = str.trim();
|
||||
if(trimmed.length() > 10) {
|
||||
if(longStrings++ > 100) break;
|
||||
}
|
||||
}
|
||||
return longStrings;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user