mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
IDEA-179280 java9 - intention to use Map.ofEntries
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// "Replace with 'Map.ofEntries' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void test() {
|
||||
Map<String, String> myMap;
|
||||
myMap = Map.ofEntries(Map.entry("a", "1"), Map.entry("b", "1"), Map.entry("c", "1"), Map.entry("d", "1"), Map.entry("e", "1"), Map.entry("f", "1"), Map.entry("g", "1"), Map.entry("h", "1"), Map.entry("i", "1"), Map.entry("j", "1"), Map.entry("k", "1"));
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace with 'Map.ofEntries' call" "true"
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Test {
|
||||
static final Map<String, String> map;
|
||||
|
||||
static {
|
||||
//_map.put("a", "b");
|
||||
map = Map.ofEntries(Map.entry("c", "d"), Map.entry("e", "f"), Map.entry("g", "h"), Map.entry("i", "j"), Map.entry("k", "l"),
|
||||
// and m
|
||||
Map.entry("m", "n"), Map.entry("o", "p"), Map.entry("r", "s"), Map.entry("t", /*uuuu*/"u"), Map.entry("v", "w"), Map.entry("x", /*you*/ "y"),
|
||||
// q was forgotten!
|
||||
Map.entry("q", "z"));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Map.of' call" "false"
|
||||
// "Replace with 'Map.ofEntries' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// "Replace with 'Map.ofEntries' call" "true"
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Test {
|
||||
static final Map<String, String> map;
|
||||
|
||||
static {
|
||||
Map<String, String> _map = new HashMap<>();
|
||||
//_map.put("a", "b");
|
||||
_map.put("c", "d");
|
||||
_map.put("e", "f");
|
||||
_map.put("g", "h");
|
||||
_map.put("i", "j");
|
||||
_map.put("k", "l");
|
||||
// and m
|
||||
_map.put("m", "n");
|
||||
_map.put("o", "p");
|
||||
_map.put("r", "s");
|
||||
_map.put("t" /*uuuu*/, "u");
|
||||
_map.put("v", "w");
|
||||
_map.put("x", /*you*/ "y");
|
||||
// q was forgotten!
|
||||
_map.put("q", "z");
|
||||
map = Collections.unmodifiab<caret>leMap(_map);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user