Java8CollectionRemoveIf: support for-each loop (IDEA-214448)

GitOrigin-RevId: 4ac219e418cc0bef8e1930d14d53256e3c87be6e
This commit is contained in:
Tagir Valeev
2019-06-19 12:02:01 +07:00
committed by intellij-monorepo-bot
parent 3cddd7b1ee
commit dea2294709
12 changed files with 281 additions and 57 deletions

View File

@@ -0,0 +1,11 @@
// "Replace the loop with Collection.removeIf" "true"
import java.util.*;
public class Main {
public void removeEmpty(List<String> list) throws Exception {
// Copy to avoid CME
for(<caret>String item : list.toArray(new String[list.size()])) {
if(item.isEmpty()) list.remove(item);
}
}
}