mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-161259 follow-up: support scenarios when iterator.next() call is inlined into condition
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace the loop with Collection.removeIf" "true"
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
public void testIterator(List<List<String>> data, boolean b) {
|
||||
data.removeIf(strings -> strings.isEmpty() && b);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace the loop with Collection.removeIf" "true"
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
public void testIterator(List<List<String>> data, boolean b) {
|
||||
for(Ite<caret>rator<List<String>> iter = data.iterator(); iter.hasNext();) {
|
||||
if(iter.next().isEmpty() && b) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace the loop with Collection.removeIf" "false"
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
public void testIterator(List<List<String>> data, boolean b) {
|
||||
for(Ite<caret>rator<List<String>> iter = data.iterator(); iter.hasNext();) {
|
||||
if(b && iter.next().isEmpty()) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace the loop with Collection.removeIf" "false"
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
public void testIterator(List<List<String>> data, boolean b) {
|
||||
for(Ite<caret>rator<List<String>> iter = data.iterator(); iter.hasNext();) {
|
||||
if(iter.next().isEmpty() && iter.next().isEmpty()) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user