вход:
public static void main(String[] args) {
final String key = "some key";
final String value = "some value";
Map<String, String> map1 = new HashMap<String, String>(){{put(key, value);}};
System.out.println(new Gson().toJson(map1) + " " + map1.get(key));
Map<String, String> map2 = new HashMap<>();
map2.put(key, value);
System.out.println(new Gson().toJson(map2) + " " + map2.get(key));
}
выход:
null some value
{"some key":"some value"} some value
Process finished with exit code 0