IDEA-173272 "Double brace initialization" may suggest 'Map.of' in JDK9

This commit is contained in:
Tagir Valeev
2017-05-24 13:03:22 +07:00
parent ef17caa239
commit 0aa303139b
3 changed files with 31 additions and 4 deletions
@@ -0,0 +1,6 @@
// "Replace with 'Map.of' call" "true"
import java.util.*;
public class Test {
private static final Map<Integer, String> myMap2 = Map.of(1, "one", 2, "two");
}
@@ -0,0 +1,11 @@
// "Replace with 'Map.of' call" "true"
import java.util.*;
public class Test {
private static final Map<Integer, String> myMap2 = Collections.unmodifiab<caret>leMap(new HashMap<>() {
{
put(1, "one");
put(2, "two");
}
});
}