Migrate to simplified collection: Map support

This commit is contained in:
Tagir Valeev
2017-02-27 17:23:21 +07:00
parent 05a2a29300
commit 0deb0dac6f
7 changed files with 118 additions and 31 deletions
@@ -0,0 +1,9 @@
// "Replace with 'Map.of' call" "true"
import java.util.*;
public class Test {
public void test() {
Map<String, String> myMap;
myMap = Map.of("a", "1", "b", "1", "c", "1", "d", "1", "e", "1", "f", "1", "g", "1", "h", "1", "i", "1", "j", "1");
}
}
@@ -0,0 +1,9 @@
// "Replace with 'Map.of' call" "true"
import java.util.*;
public class Test {
public void test() {
Map<String, String> myMap;
myMap = Map.of("a", "b", "c", "b");
}
}
@@ -0,0 +1,19 @@
// "Replace with 'Map.of' call" "true"
import java.util.*;
public class Test {
public void test() {
Map<String, String> myMap = new HashMap<>();
myMap.put("a", "1");
myMap.put("b", "1");
myMap.put("c", "1");
myMap.put("d", "1");
myMap.put("e", "1");
myMap.put("f", "1");
myMap.put("g", "1");
myMap.put("h", "1");
myMap.put("i", "1");
myMap.put("j", "1");
myMap = Collections.unmodifia<caret>bleMap(myMap);
}
}
@@ -0,0 +1,20 @@
// "Replace with 'Map.of' call" "false"
import java.util.*;
public class Test {
public void test() {
Map<String, String> myMap = new HashMap<>();
myMap.put("a", "1");
myMap.put("b", "1");
myMap.put("c", "1");
myMap.put("d", "1");
myMap.put("e", "1");
myMap.put("f", "1");
myMap.put("g", "1");
myMap.put("h", "1");
myMap.put("i", "1");
myMap.put("j", "1");
myMap.put("k", "1");
myMap = Collections.unmodifia<caret>bleMap(myMap);
}
}
@@ -0,0 +1,11 @@
// "Replace with 'Map.of' call" "false"
import java.util.*;
public class Test {
public void test() {
Map<String, String> myMap = new HashMap<>();
myMap.put("a", "b");
myMap.put("a", "c");
myMap = Collections.unmo<caret>difiableMap(myMap);
}
}
@@ -0,0 +1,11 @@
// "Replace with 'Map.of' call" "true"
import java.util.*;
public class Test {
public void test() {
Map<String, String> myMap = new HashMap<>();
myMap.put("a", "b");
myMap.put("c", "b");
myMap = Collections.unmo<caret>difiableMap(myMap);
}
}