[java-inspections] UseBulkOperation: fix quick-fix producing red code

(IDEA-278469)

GitOrigin-RevId: fc0695a4425b6c5ff009616f4e6529bfdd1c8f08
This commit is contained in:
Andrey.Cherkasov
2021-10-20 04:01:20 +03:00
committed by intellij-monorepo-bot
parent 1922f00a54
commit 91ddf5b7f4
3 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
// "Replace iteration with bulk 'Map.putAll' call" "true"
import java.util.HashMap;
import java.util.Map;
class Main extends HashMap<String, Integer> {
void test() {
Map<String, Integer> result = new HashMap<>();
result.putAll(this);
}
}

View File

@@ -0,0 +1,12 @@
// "Replace iteration with bulk 'Map.putAll' call" "true"
import java.util.HashMap;
import java.util.Map;
class Main extends HashMap<String, Integer> {
void test() {
Map<String, Integer> result = new HashMap<>();
for (Map.Entry<String, Integer> entry : super.entrySet()) {
result.pu<caret>t(entry.getKey(), entry.getValue());
}
}
}