mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-06 01:06:54 +07:00
Java8CollectionRemoveIf: support for-each loop (IDEA-214448)
GitOrigin-RevId: 4ac219e418cc0bef8e1930d14d53256e3c87be6e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3cddd7b1ee
commit
dea2294709
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user